diff options
| author | Arkadiy Butermanov <[email protected]> | 2016-03-23 15:52:49 +0300 |
|---|---|---|
| committer | Arkadiy Butermanov <[email protected]> | 2016-03-23 15:52:49 +0300 |
| commit | 0d54b473cfa8a3325e1bc3fcd5525ebb7f4b68cb (patch) | |
| tree | be63dfbb7dee67d0af0cce03405aa4da4e5ef60a /lib/axlsx/workbook/worksheet/cell_serializer.rb | |
| parent | d136835f3a3a54831ad2c7c793a51d3a57273892 (diff) | |
| download | caxlsx-0d54b473cfa8a3325e1bc3fcd5525ebb7f4b68cb.tar.gz caxlsx-0d54b473cfa8a3325e1bc3fcd5525ebb7f4b68cb.zip | |
Implement :text cell type
Diffstat (limited to 'lib/axlsx/workbook/worksheet/cell_serializer.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell_serializer.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb index 9a9f9465..4da391b6 100644 --- a/lib/axlsx/workbook/worksheet/cell_serializer.rb +++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb @@ -14,7 +14,7 @@ module Axlsx method = cell.type self.send(method, cell, str) str << '</c>' - end + end # builds an xml text run based on this cells attributes. # @param [String] str The string instance this run will be concated to. @@ -22,7 +22,7 @@ module Axlsx def run_xml_string(cell, str = '') if cell.is_text_run? valid = RichTextRun::INLINE_STYLES - [:value, :type] - data = Hash[cell.instance_values.map{ |k, v| [k.to_sym, v] }] + data = Hash[cell.instance_values.map{ |k, v| [k.to_sym, v] }] data = data.select { |key, value| valid.include?(key) && !value.nil? } RichText.new(cell.value.to_s, data).to_xml_string(str) elsif cell.contains_rich_text? @@ -124,7 +124,7 @@ module Axlsx inline_string_serialization cell, str end end - + # Serializes cells that are of the type richtext # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. @@ -137,6 +137,14 @@ module Axlsx end end + # Serializes cells that are of the type text + # @param [Cell] cell The cell that is being serialized + # @param [String] str The string the serialized content will be appended to. + # @return [String] + def text(cell, str='') + inline_string_serialization cell, str + end + private def numeric(cell, str = '') |
