2

I looking for a number format pattern to display negative number as (100,00), (1 000,05), (1 252 000,05) but with pattern like "#\ ###\ ###\ ##0_);(#\ ###\ ###\ ##0);" - ");@)" i get extra spaces after the first parenthese when the negative number is greater than -1 000 000 000.

sample of extra spaces on negative number:

(   50,05), (  1 000,05), ( 1 000 000,05), (1 000 000 000,05)

How can i manage this format?

I also tried the format "# ##0.00;(# ##0.00);" - ");@)" but work only for thousands number.

I use EPPLUS to generate excel file. I fill a string parameter with the number format when creating a cell.

davidtse
  • 41
  • 3
  • Maybe ask here: https://github.com/EPPlusSoftware/EPPlus Could be a bug. – johey Aug 17 '22 at 09:27
  • 1
    @johey - not limited to epplus: https://dotnetfiddle.net/GoAhsU – Rand Random Aug 17 '22 at 09:31
  • if you are looking for a c# solution: https://stackoverflow.com/questions/17527847/how-would-i-separate-thousands-with-space-in-c-sharp – Rand Random Aug 17 '22 at 09:32
  • or maybe you can cheat by using non-breaking whitespace: https://en.wikipedia.org/wiki/Non-breaking_space – Rand Random Aug 17 '22 at 09:35
  • By setting the NumberGroupSeparator via NumberFormatInfo it can be done within .NET but I suppose this won't help you for EPPlus: https://dotnetfiddle.net/QzVmwa. Unless you format the value manually before inputting it to EPPlus. – johey Aug 17 '22 at 09:55
  • Yes, EPPLUS get a string parameter to specify the cell format when creating the cell. – davidtse Aug 17 '22 at 10:01

1 Answers1

2

I found the solution, EPPLUS add backslash before space to given format pattern. The workaround was to use a new pattern "#,##0.00;(#,##0.00);" - ");@)".

davidtse
  • 41
  • 3