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

style中CustomNumFmt的问题 #1028

Closed
xiaozuhui opened this issue Sep 28, 2021 · 2 comments
Closed

style中CustomNumFmt的问题 #1028

xiaozuhui opened this issue Sep 28, 2021 · 2 comments

Comments

@xiaozuhui
Copy link

在生产中遇到的问题,CustomNumFmt接受的是一个字符串的引用,但是当这个字符串为空串的时候,生成的文件就会出现问题。

customNumberFormat := ""
switch dataType {
case tableim.ColTypeDate:
    customNumberFormat = DateFormat
case tableim.ColTypeNumber:
case tableim.ColTypeText:
}
syl.CustomNumFmt = &customNumberFormat

生成的文件,如果用WPS打开是可以顺利打开的
但是使用微软的Office Excel打开,就会出现报错:文件损坏
image
所以做了控制,当空串时,就不赋值,即可解决问题

@xuri xuri closed this as completed in 2d8b5b1 Sep 28, 2021
@xuri
Copy link
Member

xuri commented Sep 28, 2021

Thanks for your issue, I have fixed it, an error will be returned if given an invalid custom number format when creating a new style, please upgrade to the master branch code, and this patch will be released in the next version.

@xiaozuhui
Copy link
Author

thank you,谢谢

jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
* Fix build-in scientific number format failed
* An error will be returned if given an invalid custom number format when creating a new style
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

2 participants