Skip to content

SetCellValue changes background color of a Cell to White when writing a time.Time value into a preformatted Table #2014

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

Closed
sonic-martin opened this issue Oct 22, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@sonic-martin
Copy link

sonic-martin commented Oct 22, 2024

Description

When writing date values to a table in a worksheet using predefined table format/style, then excelize sets a white background color.

It seems to be a new bug with excelize2.9.0, because in 2.8.1 and before its working.

Steps to reproduce the issue:

  1. Prepare an excel file with a formatted table, using a predefined table format/style
  2. OpenReader that file
  3. Write a String value and a time.Time using SetCellValue
  4. SaveAs that file

See a full reproducer here: https://github.com/sonic-martin/excelize-backgroundcolor-reproducer

Describe the results you received:

The cell with the Date value has a white background color.

screenshot-2 9 0

(Screenshot with an excel file created with Excelize 2.9.0)

Describe the results you expected:

Both, the cell with the String value and with the Date value, following the predefined table format/style from the template excel file.

screenshot-2 8 1

(Screenshot with an excel file created with Excelize 2.8.1)

Output of go version:

go version go1.23.2 linux/amd64

Excelize version or commit ID:

2.9.0

Environment details (OS, Microsoft Excel™ version, physical, etc.):

Ubuntu in WSL2

Further remark

Is this maybe related to the code changes for fixing #2004?

@sonic-martin sonic-martin changed the title SetCellValue changes background color of a Cell to White when writing a time.Time value into an preformatted Table SetCellValue changes background color of a Cell to White when writing a time.Time value into a preformatted Table Oct 22, 2024
@xuri xuri added the bug Something isn't working label Oct 23, 2024
@xuri xuri closed this as completed in 4cd9dd9 Oct 23, 2024
xuri added a commit that referenced this issue Oct 23, 2024
@xuri
Copy link
Member

xuri commented Oct 23, 2024

Thanks for your feedback. I fixed this, please upgrade to the master branch code by go get -u github.com/xuri/excelize/v2@master, and this patch will be released in the next version.

@sonic-martin
Copy link
Author

Hey, is it planned to have a new release soon? So far I pinned my dependency for production to 2.8.1.

@xuri
Copy link
Member

xuri commented Dec 10, 2024

Next version will be released in 2025, before that you could be to use the code on the master branch version, with the Go module to lock the version.

@sonic-martin
Copy link
Author

Next version will be released in 2025, before that you could be to use the code on the master branch version, with the Go module to lock the version.

Any plans already for a release?

@xuri
Copy link
Member

xuri commented May 2, 2025

The next version 2.9.1 will be released on May 15th, 2025.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Bugfix
Development

No branches or pull requests

2 participants