mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #137] Issue with worksheet_write_datetime() not producing any output #110
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#110
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 @yanniupai on GitHub (Nov 21, 2017).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/137
Originally assigned to: @jmcnamara on GitHub.
Hi All:
I write a demo to test the "datetime write" with Qt 5.9.2 in Windows, but it is error. i am sure the the "lxw_datetime tmp_dt" is OK, source code like below:
The result is like below: myexcel.xlsx
But I write the datetime with string is OK, like below:
@jmcnamara commented on GitHub (Nov 21, 2017):
I can't compile a Qt program but I'd guess that the issue is that
tmp_dtisn't initialized:Try this instead:
Or whatever keeps your compiler happy.
If that isn't the issue then print out the fields of
tmp_dtbefore callingworksheet_write_datetime()and attach the results here.@jmcnamara commented on GitHub (Nov 21, 2017):
Actually, this probably isn't an issue. I thought that the struct had a hidden field but it doesn't. So your field by field assignment is probably okay. I'll look a bit deeper...
@jmcnamara commented on GitHub (Nov 21, 2017):
Looking at your example again I see that you didn't apply a number format to worksheet_write_datetime(). A number format for a date is required, see the docs for worksheet_write_datetime():
See also the Working with Dates and Times section of the docs.
@yanniupai commented on GitHub (Nov 21, 2017):
I add the code as you guide like below:
lxw_format *format = workbook_add_format(workbook); format_set_num_format(format, "yyyy-MM-dd hh:mm:ss");The result is OK. Thanks for you.
Can we add the millisecond and week to the struct lxw_datetime? Our industrial control project needs it.
And can we add the function as "worksheet_write_stringArray" to improve the writing efficiency?
@jmcnamara commented on GitHub (Nov 21, 2017):
Great. I'll close the issue.
The seconds member in
struct lxw_datetimeis a double so you can add milliseconds to that as a fraction of a second.Output:
Do you mean to write an array of strings like this:
I think functions like that are best handled by the user in their application code. They are supported in the dynamic language versions of this library (in Python, Perl and Lua) but would require a separate function for each data type in the C version. So that probably won't be added.