实施 1904 日期系统
Contents
[
Hide
]
Microsoft Excel 支持两种日期系统:1900 日期系统(Windows 在 Excel 中实现的默认日期系统)和 1904 日期系统。 1904 日期系统通常用于提供与 Macintosh Excel 文件的兼容性,如果您使用 Excel for Macintosh,则它是默认系统。您可以使用 Aspose.Cells 为 Excel 文件设置 1904 日期系统。
要在 Microsoft Excel 中实施 1904 日期系统(例如 Microsoft Excel 2003):
- 来自工具菜单,选择选项 ,然后选择计算标签。
- 选择1904年日期系统选项。
- 点击好的.
在 Microsoft Excel 中选择 1904 日期系统 |
---|
![]() |
请参阅以下示例代码,了解如何使用 Aspose.Cells API 实现此目的。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Initialize a new Workbook | |
// Open an excel file | |
Workbook workbook = new Workbook(dataDir+ "book1.xlsx"); | |
// Implement 1904 date system | |
workbook.Settings.Date1904 = true; | |
// Save the excel file | |
workbook.Save(dataDir+ "Mybook.out.xlsx"); |