Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date format #62

Closed
vchugreev opened this issue Jun 23, 2017 · 8 comments
Closed

Date format #62

vchugreev opened this issue Jun 23, 2017 · 8 comments

Comments

@vchugreev
Copy link

Hello.

Please help me with date substitution and formatting. There is an xlsx file (template), it has a field of type Date, it has a format, for example: 14-Mar-12

Using the library, I substitute my date value, for example: 2017-06-23 14:04:05 I expect that the inserted date will be of the specified format, but it is not. The inserted value is displayed unchanged: 2017-06-23 14:04:05

If start Excel, open the saved file and double-click on this field, it is converted according to the specified format. How to do this with your library?

Is there an analog UpdateLinkedValue() to update the date according to the format specified in the template?

Thank you!

xuri added a commit that referenced this issue Jun 23, 2017
…th `time.Time` data type, related issue #62;

- go doc updated
@xuri
Copy link
Member

xuri commented Jun 23, 2017

Thanks for your issue, I have update the library with handle pre-defined number format set of cell when set cell value with time.Time data type.

@vchugreev
Copy link
Author

Excellent, great thanks! Our project is rescued :). On Monday at work I'll try a new version.
P.S. Wonderful library!

@vchugreev
Copy link
Author

vchugreev commented Jun 26, 2017

How to set the date correctly? If I use
xlsx.SetCellValue ("Sheet1", "D7", time.Now())
I get ######

@xuri
Copy link
Member

xuri commented Jun 26, 2017

Try to adjust the width of the column to make it display normally.

@vchugreev
Copy link
Author

Excuse me, in Excel I'm a noob :). Everything worked out. Thank you!

@pjmuller
Copy link

Hi @Luxurioust , when passing time.Time it indeed works but when later I do a setCellStyle for a very big range (where some, not all, columns have date values)

xlsx.SetCellStyle("Sheet1", "A1", "ZZ100", {"alignment":{"wrap_text":true}})

I lose the date formatting. Is there a way how I can ADD extra formatting (the wrap_text in this case) rather than OVERWRITING them?

@xuri
Copy link
Member

xuri commented Jun 28, 2017

The new style will overwrite the old style, because function SetCellStyle() doesn't support append styles currently, so please set the style at once or set the style in batches for different area if you can.

@xuri
Copy link
Member

xuri commented Jan 8, 2021

This issue similar to #660 and #759. I close this and merge it into issue #660 is still discussing this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants