diff options
Diffstat (limited to 'lib/roo/excelx/cell/number.rb')
| -rw-r--r-- | lib/roo/excelx/cell/number.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/roo/excelx/cell/number.rb b/lib/roo/excelx/cell/number.rb index 9f23c4f..7ea48b5 100644 --- a/lib/roo/excelx/cell/number.rb +++ b/lib/roo/excelx/cell/number.rb @@ -48,7 +48,7 @@ module Roo when /^(0+)$/ then "%0#{$1.size}d" when /^0\.(0+)$/ then "%.#{$1.size}f" when '#,##0' then number_format('%.0f') - when '#,##0.00' then number_format('%.2f') + when /^#,##0.(0+)$/ then number_format("%.#{$1.size}f") when '0%' proc do |number| Kernel.format('%d%%', number.to_f * 100) @@ -64,6 +64,7 @@ module Roo when '#,##0.00;[Red](#,##0.00)' then number_format('%.2f', '[Red](%.2f)') # FIXME: not quite sure what the format should look like in this case. when '##0.0E+0' then '%.1E' + when "_-* #,##0.00\\ _€_-;\\-* #,##0.00\\ _€_-;_-* \"-\"??\\ _€_-;_-@_-" then number_format('%.2f', '-%.2f') when '@' then proc { |number| number } else raise "Unknown format: #{format.inspect}" |
