Skip to content

numfmt #2058

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
sunnyawake5 opened this issue Dec 29, 2024 · 3 comments
Closed

numfmt #2058

sunnyawake5 opened this issue Dec 29, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@sunnyawake5
Copy link

sunnyawake5 commented Dec 29, 2024

with custom numfmt "[$¥-8004]" "#" "####""", the value "80145.899999999994" format to "80145.899999999994", but excel format as "¥ 8 0146"。

after the following change, the result is correct:
in numfmt.go:
supportedLanguageCodeInfo={
"8004":xxx,
xxx
}
in printNumberLiteral func:
...
if token.TType == nfp.TokenTypeHashPlaceHolder || token.TType == nfp.TokenTypeZeroPlaceHolder {
if useLiteral && usePlaceHolder {
//change here
//return nf.value
return result
}
...

@sunnyawake5
Copy link
Author

sunnyawake5 commented Dec 29, 2024

another problem:
custom numFmt:"General"
value:0.0140760821860323
formatted to 0.01407608219
excel format to 0.014076082

@xuri
Copy link
Member

xuri commented Dec 30, 2024

Thanks for your issue. As the documentation of GetCellValue says: "If the cell format can be applied to the value of a cell, the applied value will be returned, otherwise the original value will be returned", this library doesn't support apply all kinds of number format, if the number format doesn't support will be fallback to original value. Contribution are welcome.

@xuri xuri added the enhancement New feature or request label Dec 30, 2024
@xuri xuri moved this to Features in Excelize v2.9.1 Jan 26, 2025
@xuri xuri closed this as completed in 4324622 Jan 26, 2025
@xuri
Copy link
Member

xuri commented Jan 26, 2025

I added support for apply number format with hash and zero place holder, please upgrade to the master branch code. This feature will be release in the next version.

xuri added a commit that referenced this issue Mar 4, 2025
…ce holder

- Update unit tests
- Disable blank issue creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Features
Development

No branches or pull requests

2 participants