diff options
| author | Paul Kmiec <[email protected]> | 2023-05-17 18:00:25 -0700 |
|---|---|---|
| committer | Paul Kmiec <[email protected]> | 2023-05-17 18:19:13 -0700 |
| commit | 6909ffbacf9dbfe7bfb01712ca7c47a3ca882dac (patch) | |
| tree | eb845d474ea3a4faf77ae9df97b671d513f5ac0c | |
| parent | 6a4b82def2e94b4811c38c37e606d426710d1e6c (diff) | |
| download | caxlsx-6909ffbacf9dbfe7bfb01712ca7c47a3ca882dac.tar.gz caxlsx-6909ffbacf9dbfe7bfb01712ca7c47a3ca882dac.zip | |
Add `Cell#style_str` so that we can directly return '0'
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 5 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell_serializer.rb | 2 |
2 files changed, 6 insertions, 1 deletions
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 << '<c r="' str << Axlsx::col_ref(column_index) << Axlsx::row_ref(row_index) - str << '" s="' << cell.style.to_s << '" ' + str << '" s="' << cell.style_str << '" ' return str << '/>' if cell.value.nil? method = cell.type |
