aboutsummaryrefslogtreecommitdiffstats
path: root/lib/roo/excelx/cell
diff options
context:
space:
mode:
Diffstat (limited to 'lib/roo/excelx/cell')
-rw-r--r--lib/roo/excelx/cell/number.rb3
-rw-r--r--lib/roo/excelx/cell/time.rb2
2 files changed, 3 insertions, 2 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}"
diff --git a/lib/roo/excelx/cell/time.rb b/lib/roo/excelx/cell/time.rb
index a1f0864..5fed1e2 100644
--- a/lib/roo/excelx/cell/time.rb
+++ b/lib/roo/excelx/cell/time.rb
@@ -13,7 +13,7 @@ module Roo
super
@format = excelx_type.last
@datetime = create_datetime(base_date, value)
- @value = link ? Roo::Link.new(link, value) : (value.to_f * 86_400).to_i
+ @value = link ? Roo::Link.new(link, value) : (value.to_f * 86_400).round.to_i
end
def formatted_value