mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #483] Add a way to configure the output file to 1904 excel #376
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#376
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DocJesus on GitHub (Jun 27, 2025).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/483
Originally assigned to: @jmcnamara on GitHub.
Hello,
Unless I am mistaken I noticed that it is not possible to set an output file to 1904 via the lib, despite seeing in the code this enum in common.h:
I understand that excel would read such status in xl/workbook.xml file in the attribute workbookPr at "date1904" (see exemple below)
(will give me a file that has the settings "Use 1904 date system" box ticked)
One way I have to solve this would be manually to unzip the excel file I created, then change the workbook.xml file and zip it back, but wouldn't it be better with a build-in method ?
such method exists in python :
workbook = xlsxwriter.Workbook(filename, {'date_1904': True})Please feel free to correct me and guide me if it exists a way to do this with the current version of the lib
Many thanks
@jmcnamara commented on GitHub (Jun 27, 2025):
Thanks for the request. I can look into adding it. Most of the infrastructure is already there and, as you point out, I implemented it in the Python and Perl versions.
May I ask why you want to use the 1904 epoch?
@DocJesus commented on GitHub (Jun 27, 2025):
excel cannot handle negative time, one way to do it is to use a negativ number like "-0.29" and set its format to "[hh]:mm".
Such operation is possible only in 1904 epoch
@jmcnamara commented on GitHub (Jun 29, 2025):
I've added support for the 1904 epoch to main. It can be enabled via the following workbook function:
It should be called before
workbook_add_worksheet().Here is an example:
If you get a chance please try it and let me know how you get on.
@DocJesus commented on GitHub (Jun 30, 2025):
thank you very much I will keep you in touch of my tests
@DocJesus commented on GitHub (Jun 30, 2025):
I have updated my library and tried the workbook_use_1904_epoch method, it works well
@jmcnamara commented on GitHub (Jun 30, 2025):
Thanks for letting me know. I'll roll this into a release in the next 1-2 days.
@jmcnamara commented on GitHub (Jun 30, 2025):
Available in v1.2.3.