Skip to content

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

@sonic-martin

Description

@sonic-martin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions