From 6909ffbacf9dbfe7bfb01712ca7c47a3ca882dac Mon Sep 17 00:00:00 2001 From: Paul Kmiec Date: Wed, 17 May 2023 18:00:25 -0700 Subject: Add `Cell#style_str` so that we can directly return '0' --- lib/axlsx/workbook/worksheet/cell.rb | 5 +++++ lib/axlsx/workbook/worksheet/cell_serializer.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 4d1bae63..377307aa 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -80,6 +80,11 @@ module Axlsx defined?(@style) ? @style : 0 end + # Internal + def style_str + defined?(@style) ? @style.to_s : '0' + end + attr_accessor :raw_style # The index of the cellXfs item to be applied to this cell. diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb index f45d3c73..c9bee5b0 100644 --- a/lib/axlsx/workbook/worksheet/cell_serializer.rb +++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb @@ -12,7 +12,7 @@ module Axlsx def to_xml_string(row_index, column_index, cell, str = +'') str << '' if cell.value.nil? method = cell.type -- cgit v1.2.3