Closed Antonio225t closed 7 months ago
Datetimes in Excel are numbers with a format. See the docs on ExcelDateTime and Datetimes in Excel.
So, if you are trying to write dates as strings that won't work. If that isn't the case then submit a small working program that shows the issue.
(I made it a question because I didn't want to make another bug for then it to be solved after 15 minutes.)
Questions are fine. But for your own sake have a read through the Tutorial and maybe some of the reference examples in the Cookbook.
Thanks for the information, I'll read the Tutorial and the Cookbook. Anyways I saw that this is present even with single numbers (like "5"
renders '5
)
Anyways I saw that this is present even with single numbers (like
"5"
renders'5
)
In that case add a small complete example program that demonstrates the issue.
This is what I used:
worksheet.write_string_with_format(row+1, col+7, "5", &Format::new().set_num_format("€ 0,00").set_border_top(FormatBorder::Dashed).set_border_bottom(FormatBorder::Double).set_border_left(FormatBorder::Thin).set_border_right(FormatBorder::Thin))?;```
Alright I guess that the error was me using worksheet.write_string_with_format
instead of worksheet.write_number_with_format
Yes it was the issue, with ExcelDateTime
and everything works fine now. Thanks for pointing out where to search in case I'm not understanding something 😄
Alright I guess that the error was me using
worksheet.write_string_with_format
instead ofworksheet.write_number_with_format
Yes it was the issue. Thanks for pointing out where to search in case I'm not understanding something
No worries. For what it is worth here is what that output would look like in Excel:
I think the apostrophe is LibreOffice's way of saying "Number stored as string".
Such an odd way but at least I now know it. Thanks for the information and hard work 😃
Question
It's pretty weird but it happens for
23/07/2023
and23/07/23
it renders a'
at the start when rendering it and it prevents for formatting the date (I put a.set_num_format("dd mmm yyyy")
in the format, but it shows the'
even without the format). Is this normal behaviour?(I made it a question because I didn't want to make another bug for then it to be solved after 15 minutes.)