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

Set Style function like setCellStyle is not work while cell number value like(`[number]) #1211

Closed
chenxiankong opened this issue Apr 27, 2022 · 1 comment
Projects

Comments

@chenxiankong
Copy link

chenxiankong commented Apr 27, 2022

Description
Hi, When the following cells exist, the function to set the style will not work.
Invalidation function: setColStyle, setCellStyle
Cell: pure number, the format is conventional, the actual content is "`[number]", such as [`11111111111111]
image
The [`] symbol tells excel to use text to display numbers instead of scientific notation

Steps to reproduce the issue:
excel file:
testExcel.xlsx

func main() {
	f, err := excelize.OpenFile("xxx/testExcel.xlsx")
	if err != nil {
		panic(err)
	}
	style, err := f.NewStyle(&excelize.Style{
		Fill: excelize.Fill{
			Type:    "pattern",
			Pattern: 1,
			Color:   []string{"#383c43"},
		},
		Font: &excelize.Font{
			Color: "#fffafa",
		},
		Alignment: &excelize.Alignment{
			Horizontal: "center",
			Vertical:   "center",
		},
	})
	if err != nil {
		panic(err)
	}

	if err := f.SetCellStyle("sheet1", "A1", "A2", style); err != nil {
		panic(err)
	}

	if err := f.Save(); err != nil {
		panic(err)
	}
}

Describe the results you received:
image

Describe the results you expected:
image

Output of go version:

go version go1.16.15 darwin/amd64

Excelize version or commit ID:

v2.6.0

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

Best Wishes

@chenxiankong chenxiankong changed the title function setCellStyle is not effect while cell number value like(`[number]) Set Style function like setCellStyle is not work while cell number value like(`[number]) Apr 27, 2022
@xuri
Copy link
Member

xuri commented Apr 28, 2022

Thanks for your issue. The coordinates of cell with single quote symbol in your spreadsheet is A3, but the range in the SetCellStyle not include A3.

@xuri xuri added the wontfix This will not be worked on label Apr 28, 2022
@xuri xuri closed this as completed in df91b34 Apr 28, 2022
@xuri xuri removed the wontfix This will not be worked on label Apr 28, 2022
@xuri xuri added this to Compatibility in v2.6.1 Jul 7, 2022
xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v2.6.1
Compatibility
Development

No branches or pull requests

2 participants