-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
How to format numbers to Accounting format? #189
Comments
Thanks for your issue. This library not support set Accounting number format currently. I will consider to add this feature later and also welcome to contribute to this project. |
Sorry for my so late reply. Excelize support set custom Accounting number format since f := excelize.NewFile()
if err := f.SetCellValue("Sheet1", "A1", 100); err != nil {
fmt.Println(err)
return
}
fmtCode := `_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)`
styleID, err := f.NewStyle(&excelize.Style{CustomNumFmt: &fmtCode})
if err != nil {
fmt.Println(err)
return
}
if err := f.SetCellStyle("Sheet1", "A1", "A1", styleID); err != nil {
fmt.Println(err)
return
}
// Save spreadsheet by the given path.
if err := f.SaveAs("Book1.xlsx"); err != nil {
fmt.Println(err)
} I'll close this issue, if you have any questions, please let me know. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From issue #80 ,I know how to format numbers to currency , but how do I format them to Accounting format? Thanks!
(pic from #80)
The text was updated successfully, but these errors were encountered: