实现1904日期系统
Contents
[
Hide
]
微软 Excel 支持两种日期系统:1900 日期系统(Excel for Windows 的默认日期系统)和 1904 日期系统。1904 日期系统通常用于与 Macintosh Excel 文件的兼容性,如果您使用的是 Macintosh 版 Excel,则是默认系统。您可以使用 Aspose.Cells for Python via .NET 为 Excel 文件设置 1904 日期系统。
在 Microsoft Excel 中实现1904日期系统(例如 Microsoft Excel 2003):
- 从“工具”菜单中选择“选项”,并选择“计算”选项卡。
- 选择“1904日期系统”选项。
- 点击确定。
在Microsoft Excel中选择1904日期系统 |
---|
![]() |
请参阅以下示例代码,了解如何使用 Aspose.Cells for Python via .NET API 实现此功能。 |
This file contains hidden or 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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Initialize a new Workbook | |
# Open an excel file | |
workbook = Workbook(dataDir + "book1.xlsx") | |
# Implement 1904 date system | |
workbook.settings.date1904 = True | |
# Save the excel file | |
workbook.save(dataDir + "Mybook.out.xlsx") |