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

Maintain trailing zeroes in decimal positions #52

Closed
matt-dray opened this issue Mar 16, 2022 · 1 comment
Closed

Maintain trailing zeroes in decimal positions #52

matt-dray opened this issue Mar 16, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@matt-dray
Copy link
Collaborator

There's been a request to:

...have percentage estimates be displayed to a chosen number of decimal places consistently throughout a sheet/tab.

So 1.200, 1.230 and 1.234 are presented as-is, without Excel truncating those trailing zeroes to produce the visually-inconsistent 1.2, 1.23 and 1.234.

I would have thought about a sprintf() solution, but looks like applying styles with {openxlsx} negates this:

I have attempted implementing this using base::sprintf() on the numbers but then whenever I applied a style from openxlsx e.g. to right align etc. it just defaulted to the situation I described above. openxlsx::createStyle(numFmt = “0.00”) also didn’t work for me.

@matt-dray matt-dray added the enhancement New feature or request label Mar 16, 2022
@matt-dray matt-dray added this to the v0.2.0 milestone Jun 16, 2022
@matt-dray
Copy link
Collaborator Author

This worked for me on numeric columns when I use the {openxlsx} options, mentioned in #69. In other words, when I had values of 1, 1.2, 1.23 and set the options to options("openxlsx.numFmt" = "#,0.000"), they became 1.000, 1.200 and 1.230. Therefore closing this issue in favour of #69.

@matt-dray matt-dray removed this from the v0.3 milestone Jan 4, 2024
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
None yet
Development

No branches or pull requests

1 participant