From 67aefd7705df82e43a8670102400a5abab49f6e8 Mon Sep 17 00:00:00 2001 From: Paul Kmiec Date: Fri, 5 May 2023 08:58:17 -0700 Subject: Pipe output directly to str and avoid additional memory allocations Currently, there are lots of examples of code like this, ``` str << ('') ``` which create the string for the tag in memory before piping to str. We can avoid creating all of these intermediate strings by dropping the paranthesis and piping directly to str. This relies on the `str` passed around to handle lots of small appends. This is a problem when using RubyZip, but that is solved in the next commit. --- lib/axlsx/content_type/abstract_content_type.rb | 2 +- lib/axlsx/content_type/content_type.rb | 2 +- lib/axlsx/doc_props/app.rb | 2 +- lib/axlsx/doc_props/core.rb | 10 +++++----- lib/axlsx/drawing/area_chart.rb | 8 ++++---- lib/axlsx/drawing/area_series.rb | 6 +++--- lib/axlsx/drawing/axes.rb | 2 +- lib/axlsx/drawing/axis.rb | 18 +++++++++--------- lib/axlsx/drawing/bar_3D_chart.rb | 12 ++++++------ lib/axlsx/drawing/bar_chart.rb | 12 ++++++------ lib/axlsx/drawing/bar_series.rb | 8 ++++---- lib/axlsx/drawing/bubble_chart.rb | 2 +- lib/axlsx/drawing/bubble_series.rb | 4 ++-- lib/axlsx/drawing/cat_axis.rb | 10 +++++----- lib/axlsx/drawing/chart.rb | 16 ++++++++-------- lib/axlsx/drawing/drawing.rb | 2 +- lib/axlsx/drawing/graphic_frame.rb | 6 +++--- lib/axlsx/drawing/line_3D_chart.rb | 2 +- lib/axlsx/drawing/line_chart.rb | 8 ++++---- lib/axlsx/drawing/line_series.rb | 6 +++--- lib/axlsx/drawing/marker.rb | 2 +- lib/axlsx/drawing/num_data.rb | 8 ++++---- lib/axlsx/drawing/num_data_source.rb | 10 +++++----- lib/axlsx/drawing/num_val.rb | 2 +- lib/axlsx/drawing/one_cell_anchor.rb | 2 +- lib/axlsx/drawing/pic.rb | 2 +- lib/axlsx/drawing/pie_3D_chart.rb | 2 +- lib/axlsx/drawing/pie_series.rb | 4 ++-- lib/axlsx/drawing/scaling.rb | 8 ++++---- lib/axlsx/drawing/scatter_chart.rb | 4 ++-- lib/axlsx/drawing/scatter_series.rb | 10 +++++----- lib/axlsx/drawing/ser_axis.rb | 4 ++-- lib/axlsx/drawing/series.rb | 4 ++-- lib/axlsx/drawing/series_title.rb | 4 ++-- lib/axlsx/drawing/str_data.rb | 6 +++--- lib/axlsx/drawing/str_val.rb | 2 +- lib/axlsx/drawing/title.rb | 8 ++++---- lib/axlsx/drawing/val_axis.rb | 2 +- lib/axlsx/rels/relationship.rb | 2 +- lib/axlsx/rels/relationships.rb | 2 +- lib/axlsx/stylesheet/border_pr.rb | 4 ++-- lib/axlsx/stylesheet/font.rb | 2 +- lib/axlsx/stylesheet/gradient_stop.rb | 2 +- lib/axlsx/stylesheet/pattern_fill.rb | 2 +- lib/axlsx/stylesheet/styles.rb | 2 +- lib/axlsx/util/simple_typed_list.rb | 4 ++-- lib/axlsx/workbook/defined_name.rb | 4 ++-- lib/axlsx/workbook/shared_strings_table.rb | 6 +++--- lib/axlsx/workbook/workbook.rb | 6 +++--- .../workbook/worksheet/auto_filter/filter_column.rb | 4 +++- lib/axlsx/workbook/worksheet/auto_filter/filters.rb | 4 +++- lib/axlsx/workbook/worksheet/cell_serializer.rb | 16 ++++++++-------- lib/axlsx/workbook/worksheet/col_breaks.rb | 2 +- lib/axlsx/workbook/worksheet/comment.rb | 6 +++--- lib/axlsx/workbook/worksheet/comments.rb | 4 ++-- .../workbook/worksheet/conditional_formatting.rb | 4 ++-- .../worksheet/conditional_formatting_rule.rb | 2 +- lib/axlsx/workbook/worksheet/data_validation.rb | 10 +++++----- lib/axlsx/workbook/worksheet/outline_pr.rb | 4 +++- lib/axlsx/workbook/worksheet/page_set_up_pr.rb | 4 +++- lib/axlsx/workbook/worksheet/pivot_table.rb | 20 ++++++++++---------- .../worksheet/pivot_table_cache_definition.rb | 8 ++++---- lib/axlsx/workbook/worksheet/rich_text_run.rb | 6 +++--- lib/axlsx/workbook/worksheet/row.rb | 4 +--- lib/axlsx/workbook/worksheet/row_breaks.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_calc_pr.rb | 4 +++- lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 4 +++- lib/axlsx/workbook/worksheet/sheet_pr.rb | 4 +++- lib/axlsx/workbook/worksheet/table.rb | 10 +++++----- lib/axlsx/workbook/worksheet/worksheet.rb | 4 ++-- 70 files changed, 198 insertions(+), 186 deletions(-) diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb index 58ca8b2c..bca08b7e 100644 --- a/lib/axlsx/content_type/abstract_content_type.rb +++ b/lib/axlsx/content_type/abstract_content_type.rb @@ -24,7 +24,7 @@ module Axlsx # Serialize the contenty type to xml def to_xml_string(node_name = '', str = +'') str << "<#{node_name} " - str << Axlsx.instance_values_for(self).map { |key, value| Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ') + Axlsx.instance_values_for(self).each { |key, value| str << Axlsx::camel(key) << '="' << value.to_s << '" ' } str << '/>' end end diff --git a/lib/axlsx/content_type/content_type.rb b/lib/axlsx/content_type/content_type.rb index 15751b17..22763bfb 100644 --- a/lib/axlsx/content_type/content_type.rb +++ b/lib/axlsx/content_type/content_type.rb @@ -16,7 +16,7 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') + str << '' each { |type| type.to_xml_string(str) } str << '' end diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index 3eae1e28..40a8184d 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -221,7 +221,7 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') + str << '' Axlsx.instance_values_for(self).each do |key, value| node_name = Axlsx.camel(key) str << "<#{node_name}>#{value}" diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb index 8d3292e9..8dbe4cf4 100644 --- a/lib/axlsx/doc_props/core.rb +++ b/lib/axlsx/doc_props/core.rb @@ -24,11 +24,11 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') - str << (+'' << self.creator << '') - str << (+'' << (created || Time.now).strftime('%Y-%m-%dT%H:%M:%S') << 'Z') + str << '' + str << '' << self.creator << '' + str << '' << (created || Time.now).strftime('%Y-%m-%dT%H:%M:%S') << 'Z' str << '0' str << '' end diff --git a/lib/axlsx/drawing/area_chart.rb b/lib/axlsx/drawing/area_chart.rb index 8339c255..96711cd3 100644 --- a/lib/axlsx/drawing/area_chart.rb +++ b/lib/axlsx/drawing/area_chart.rb @@ -76,14 +76,14 @@ module Axlsx # @return [String] def to_xml_string(str = +'') super(str) do - str << (+"") - str << (+'') - str << (+'') + str << "" + str << '' + str << '' @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls yield if block_given? axes.to_xml_string(str, :ids => true) - str << (+"") + str << "" axes.to_xml_string(str) end end diff --git a/lib/axlsx/drawing/area_series.rb b/lib/axlsx/drawing/area_series.rb index 9d87d078..5cebd7da 100644 --- a/lib/axlsx/drawing/area_series.rb +++ b/lib/axlsx/drawing/area_series.rb @@ -75,11 +75,11 @@ module Axlsx super(str) do if color str << '' - str << (+'') + str << '' str << '' str << '' str << '' - str << (+'') + str << '' str << '' str << '' str << '' @@ -94,7 +94,7 @@ module Axlsx @labels.to_xml_string(str) unless @labels.nil? @data.to_xml_string(str) unless @data.nil? - str << (+'') + str << '' end end diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index 0baad85f..eb4728c6 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -33,7 +33,7 @@ module Axlsx if options[:ids] # CatAxis must come first in the XML (for Microsoft Excel at least) sorted = axes.sort_by { |name, axis| axis.kind_of?(CatAxis) ? 0 : 1 } - sorted.each { |axis| str << (+'') } + sorted.each { |axis| str << '' } else axes.each { |axis| axis[1].to_xml_string(str) } end diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index 38e57da5..10ddce1f 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -149,10 +149,10 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = +'') - str << (+'') + str << '' @scaling.to_xml_string str - str << (+'') - str << (+'') + str << '' + str << '' str << '' # TODO: shape properties need to be extracted into a class if gridlines == false @@ -167,21 +167,21 @@ module Axlsx # Need to set sourceLinked to 0 if we're setting a format code on this row # otherwise it will never take, as it will always prefer the 'General' formatting # of the cells themselves - str << (+'') + str << '' str << '' str << '' - str << (+'') + str << '' # TODO: this is also being used for series colors # time to extract this into a class spPr - Shape Properties if @color str << '' - str << (+'') + str << '' str << '' end # some potential value in implementing this in full. Very detailed! - str << (+'') - str << (+'') - str << (+'') + str << '' + str << '' + str << '' end end end diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 37ac7dab..fe347d7c 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -123,14 +123,14 @@ module Axlsx def to_xml_string(str = +'') super(str) do str << '' - str << (+'') - str << (+'') - str << (+'') + str << '' + str << '' + str << '' @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls - str << (+'') unless @gap_width.nil? - str << (+'') unless @gap_depth.nil? - str << (+'') unless @shape.nil? + str << '' unless @gap_width.nil? + str << '' unless @gap_depth.nil? + str << '' unless @shape.nil? axes.to_xml_string(str, :ids => true) str << '' axes.to_xml_string(str) diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb index eca54dfc..237ffdb3 100644 --- a/lib/axlsx/drawing/bar_chart.rb +++ b/lib/axlsx/drawing/bar_chart.rb @@ -113,14 +113,14 @@ module Axlsx def to_xml_string(str = +'') super(str) do str << '' - str << (+'') - str << (+'') - str << (+'') + str << '' + str << '' + str << '' @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls - str << (+'') unless @overlap.nil? - str << (+'') unless @gap_width.nil? - str << (+'') unless @shape.nil? + str << '' unless @overlap.nil? + str << '' unless @gap_width.nil? + str << '' unless @shape.nil? axes.to_xml_string(str, :ids => true) str << '' axes.to_xml_string(str) diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index c744175f..483a0c43 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -62,15 +62,15 @@ module Axlsx super(str) do colors.each_with_index do |c, index| str << '' - str << (+'') + str << '' str << '' - str << (+'') + str << '' str << '' end if series_color str << '' - str << (+'') + str << '' str << '' str << '' end @@ -78,7 +78,7 @@ module Axlsx @labels.to_xml_string(str) unless @labels.nil? @data.to_xml_string(str) unless @data.nil? # this is actually only required for shapes other than box - str << (+'') + str << '' end end diff --git a/lib/axlsx/drawing/bubble_chart.rb b/lib/axlsx/drawing/bubble_chart.rb index b4932042..727f89a7 100644 --- a/lib/axlsx/drawing/bubble_chart.rb +++ b/lib/axlsx/drawing/bubble_chart.rb @@ -38,7 +38,7 @@ module Axlsx def to_xml_string(str = +'') super(str) do str << '' - str << (+'') + str << '' @series.each { |ser| ser.to_xml_string(str) } d_lbls.to_xml_string(str) if @d_lbls axes.to_xml_string(str, :ids => true) diff --git a/lib/axlsx/drawing/bubble_series.rb b/lib/axlsx/drawing/bubble_series.rb index 25335270..b5903259 100644 --- a/lib/axlsx/drawing/bubble_series.rb +++ b/lib/axlsx/drawing/bubble_series.rb @@ -46,10 +46,10 @@ module Axlsx # needs to override the super color here to push in ln/and something else! if color str << '' - str << (+'') + str << '' str << '' str << '' - str << (+'') + str << '' str << '' end @xData.to_xml_string(str) unless @xData.nil? diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index a36f62d1..2f40f29f 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -71,11 +71,11 @@ module Axlsx def to_xml_string(str = +'') str << '' super(str) - str << (+'') - str << (+'') - str << (+'') - str << (+'') - str << (+'') + str << '' + str << '' + str << '' + str << '' + str << '' str << '' end end diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 300a5086..436319fb 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -206,13 +206,13 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') - str << (+'') - str << (+'') - str << (+'') + str << '' + str << '' + str << '' + str << '' str << '' @title.to_xml_string(str) unless @title.empty? - str << (+'') + str << '' @view_3D.to_xml_string(str) if @view_3D str << '' str << '' @@ -223,13 +223,13 @@ module Axlsx str << '' if @show_legend str << '' - str << (+'') + str << '' str << '' str << '' str << '' end - str << (+'') - str << (+'') + str << '' + str << '' str << '' str << '' if bg_color diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 7be169be..ef532974 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -157,7 +157,7 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') + str << '' anchors.each { |anchor| anchor.to_xml_string(str) } str << '' end diff --git a/lib/axlsx/drawing/graphic_frame.rb b/lib/axlsx/drawing/graphic_frame.rb index 7d0e818c..4e5b4c36 100644 --- a/lib/axlsx/drawing/graphic_frame.rb +++ b/lib/axlsx/drawing/graphic_frame.rb @@ -35,7 +35,7 @@ module Axlsx # macro attribute should be optional! str << '' str << '' - str << (+'') + str << '' str << '' str << '' str << '' @@ -43,8 +43,8 @@ module Axlsx str << '' str << '' str << '' - str << (+'') - str << (+'') + str << '' + str << '' str << '' str << '' str << '' diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index 6a659550..f9f9606e 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -59,7 +59,7 @@ module Axlsx # @return [String] def to_xml_string(str = +'') super(str) do - str << (+'') unless @gap_depth.nil? + str << '' unless @gap_depth.nil? end end end diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb index ab2012c7..21327820 100644 --- a/lib/axlsx/drawing/line_chart.rb +++ b/lib/axlsx/drawing/line_chart.rb @@ -76,14 +76,14 @@ module Axlsx # @return [String] def to_xml_string(str = +'') super(str) do - str << (+"") - str << (+'') - str << (+'') + str << "" + str << '' + str << '' @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls yield if block_given? axes.to_xml_string(str, :ids => true) - str << (+"") + str << "" axes.to_xml_string(str) end end diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb index 42c86873..bbd3957e 100644 --- a/lib/axlsx/drawing/line_series.rb +++ b/lib/axlsx/drawing/line_series.rb @@ -75,11 +75,11 @@ module Axlsx super(str) do if color str << '' - str << (+'') + str << '' str << '' str << '' str << '' - str << (+'') + str << '' str << '' str << '' str << '' @@ -94,7 +94,7 @@ module Axlsx @labels.to_xml_string(str) unless @labels.nil? @data.to_xml_string(str) unless @data.nil? - str << (+'') + str << '' end end diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 987af605..a1801eb9 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -58,7 +58,7 @@ module Axlsx # @return [String] def to_xml_string(str = +'') [:col, :colOff, :row, :rowOff].each do |k| - str << (+'' << self.send(k).to_s << '') + str << '' << self.send(k).to_s << '' end end diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb index 79108777..fdcf505c 100644 --- a/lib/axlsx/drawing/num_data.rb +++ b/lib/axlsx/drawing/num_data.rb @@ -37,13 +37,13 @@ module Axlsx # serialize the object def to_xml_string(str = +'') - str << (+'') - str << (+'' << format_code.to_s << '') - str << (+'') + str << '' + str << '' << format_code.to_s << '' + str << '' @pt.each_with_index do |num_val, index| num_val.to_xml_string index, str end - str << (+'') + str << '' end end end diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb index af5e31ab..0845ad31 100644 --- a/lib/axlsx/drawing/num_data_source.rb +++ b/lib/axlsx/drawing/num_data_source.rb @@ -45,16 +45,16 @@ module Axlsx # serialize the object # @param [String] str def to_xml_string(str = +'') - str << (+'') + str << '' if @f - str << (+'') - str << (+'' << @f.to_s << '') + str << '' + str << '' << @f.to_s << '' end @data.to_xml_string str if @f - str << (+'') + str << '' end - str << (+'') + str << '' end end end diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb index b614f561..19829a30 100644 --- a/lib/axlsx/drawing/num_val.rb +++ b/lib/axlsx/drawing/num_val.rb @@ -26,7 +26,7 @@ module Axlsx def to_xml_string(idx, str = +'') Axlsx::validate_unsigned_int(idx) if !v.to_s.empty? - str << (+'' << v.to_s << '') + str << '' << v.to_s << '' end end end diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb index f98d65a1..59d0d972 100644 --- a/lib/axlsx/drawing/one_cell_anchor.rb +++ b/lib/axlsx/drawing/one_cell_anchor.rb @@ -79,7 +79,7 @@ module Axlsx str << '' from.to_xml_string(str) str << '' - str << (+'') + str << '' @object.to_xml_string(str) str << '' str << '' diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index eec92a9c..77a051c3 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -192,7 +192,7 @@ module Axlsx def to_xml_string(str = +'') str << '' str << '' - str << (+'') + str << '' hyperlink.to_xml_string(str) if hyperlink.is_a?(Hyperlink) str << '' picture_locking.to_xml_string(str) diff --git a/lib/axlsx/drawing/pie_3D_chart.rb b/lib/axlsx/drawing/pie_3D_chart.rb index 1c68dbb7..aeb002d8 100644 --- a/lib/axlsx/drawing/pie_3D_chart.rb +++ b/lib/axlsx/drawing/pie_3D_chart.rb @@ -34,7 +34,7 @@ module Axlsx def to_xml_string(str = +'') super(str) do str << '' - str << (+'') + str << '' @series.each { |ser| ser.to_xml_string(str) } d_lbls.to_xml_string(str) if @d_lbls str << '' diff --git a/lib/axlsx/drawing/pie_series.rb b/lib/axlsx/drawing/pie_series.rb index 52cd2b66..f3edd1e9 100644 --- a/lib/axlsx/drawing/pie_series.rb +++ b/lib/axlsx/drawing/pie_series.rb @@ -49,9 +49,9 @@ module Axlsx str << '' unless @explosion.nil? colors.each_with_index do |c, index| str << '' - str << (+'') + str << '' str << '' - str << (+'') + str << '' str << '' end @labels.to_xml_string str unless @labels.nil? diff --git a/lib/axlsx/drawing/scaling.rb b/lib/axlsx/drawing/scaling.rb index fc4b9d10..4d5a9d2a 100644 --- a/lib/axlsx/drawing/scaling.rb +++ b/lib/axlsx/drawing/scaling.rb @@ -49,10 +49,10 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') unless @logBase.nil? - str << (+'') unless @orientation.nil? - str << (+'') unless @min.nil? - str << (+'') unless @max.nil? + str << '' unless @logBase.nil? + str << '' unless @orientation.nil? + str << '' unless @min.nil? + str << '' unless @max.nil? str << '' end end diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb index b518c594..60b7c5b3 100644 --- a/lib/axlsx/drawing/scatter_chart.rb +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -52,8 +52,8 @@ module Axlsx def to_xml_string(str = +'') super(str) do str << '' - str << (+'') - str << (+'') + str << '' + str << '' @series.each { |ser| ser.to_xml_string(str) } d_lbls.to_xml_string(str) if @d_lbls axes.to_xml_string(str, :ids => true) diff --git a/lib/axlsx/drawing/scatter_series.rb b/lib/axlsx/drawing/scatter_series.rb index e52306f5..9c6e12f2 100644 --- a/lib/axlsx/drawing/scatter_series.rb +++ b/lib/axlsx/drawing/scatter_series.rb @@ -85,17 +85,17 @@ module Axlsx # needs to override the super color here to push in ln/and something else! if color str << '' - str << (+'') + str << '' str << '' str << '' - str << (+'') + str << '' str << '' str << '' str << '' - str << (+'') + str << '' str << '' str << '' - str << (+'') + str << '' str << '' str << marker_symbol_xml str << '' @@ -110,7 +110,7 @@ module Axlsx end @xData.to_xml_string(str) unless @xData.nil? @yData.to_xml_string(str) unless @yData.nil? - str << (+'') + str << '' end str end diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index 63628b14..4fea58e5 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -35,8 +35,8 @@ module Axlsx def to_xml_string(str = +'') str << '' super(str) - str << (+'') unless @tick_lbl_skip.nil? - str << (+'') unless @tick_mark_skip.nil? + str << '' unless @tick_lbl_skip.nil? + str << '' unless @tick_mark_skip.nil? str << '' end end diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index a468a6b7..5a91dd44 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -59,8 +59,8 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') - str << (+'') + str << '' + str << '' title.to_xml_string(str) unless title.nil? yield if block_given? str << '' diff --git a/lib/axlsx/drawing/series_title.rb b/lib/axlsx/drawing/series_title.rb index 2887495c..08e5e909 100644 --- a/lib/axlsx/drawing/series_title.rb +++ b/lib/axlsx/drawing/series_title.rb @@ -11,11 +11,11 @@ module Axlsx str << '' str << '' - str << (+'' << Axlsx::cell_range([@cell]) << '') + str << '' << Axlsx::cell_range([@cell]) << '' str << '' str << '' str << '' - str << (+'' << clean_value << '') + str << '' << clean_value << '' str << '' str << '' str << '' diff --git a/lib/axlsx/drawing/str_data.rb b/lib/axlsx/drawing/str_data.rb index 0765671f..5ab15c39 100644 --- a/lib/axlsx/drawing/str_data.rb +++ b/lib/axlsx/drawing/str_data.rb @@ -28,12 +28,12 @@ module Axlsx # serialize the object def to_xml_string(str = +'') - str << (+'') - str << (+'') + str << '' + str << '' @pt.each_with_index do |value, index| value.to_xml_string index, str end - str << (+'') + str << '' end end end diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb index 821c7037..d09e6ce8 100644 --- a/lib/axlsx/drawing/str_val.rb +++ b/lib/axlsx/drawing/str_val.rb @@ -26,7 +26,7 @@ module Axlsx def to_xml_string(idx, str = +'') Axlsx::validate_unsigned_int(idx) if !v.to_s.empty? - str << (+'' << ::CGI.escapeHTML(v.to_s) << '') + str << '' << ::CGI.escapeHTML(v.to_s) << '' end end end diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index 7bd41b17..c3ca9632 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -76,11 +76,11 @@ module Axlsx str << '' if @cell.is_a?(Cell) str << '' - str << (+'' << Axlsx::cell_range([@cell]) << '') + str << '' << Axlsx::cell_range([@cell]) << '' str << '' str << '' str << '' - str << (+'' << clean_value << '') + str << '' << clean_value << '' str << '' str << '' str << '' @@ -90,8 +90,8 @@ module Axlsx str << '' str << '' str << '' - str << (+'') - str << (+'' << clean_value << '') + str << '' + str << '' << clean_value << '' str << '' str << '' str << '' diff --git a/lib/axlsx/drawing/val_axis.rb b/lib/axlsx/drawing/val_axis.rb index 1200eb5d..3ae8f73a 100644 --- a/lib/axlsx/drawing/val_axis.rb +++ b/lib/axlsx/drawing/val_axis.rb @@ -29,7 +29,7 @@ module Axlsx def to_xml_string(str = +'') str << '' super(str) - str << (+'') + str << '' str << '' end end diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index d9393b15..e379fa41 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -105,7 +105,7 @@ module Axlsx def to_xml_string(str = +'') h = Axlsx.instance_values_for(self).reject { |k, _| k == "source_obj" } str << '' end diff --git a/lib/axlsx/rels/relationships.rb b/lib/axlsx/rels/relationships.rb index ec5b16e9..3aa9c1bf 100644 --- a/lib/axlsx/rels/relationships.rb +++ b/lib/axlsx/rels/relationships.rb @@ -23,7 +23,7 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') + str << '' each { |rel| rel.to_xml_string(str) } str << '' end diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb index 154b25f4..ad4e29fa 100644 --- a/lib/axlsx/stylesheet/border_pr.rb +++ b/lib/axlsx/stylesheet/border_pr.rb @@ -63,9 +63,9 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = +'') - str << (+'<' << @name.to_s << ' style="' << @style.to_s << '">') + str << '<' << @name.to_s << ' style="' << @style.to_s << '">' @color.to_xml_string(str) if @color.is_a?(Color) - str << (+'') + str << '' end end end diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index 463b8fc0..8b183b6e 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -151,7 +151,7 @@ module Axlsx def to_xml_string(str = +'') str << '' Axlsx.instance_values_for(self).each do |k, v| - v.is_a?(Color) ? v.to_xml_string(str) : (str << (+'<' << k.to_s << ' val="' << Axlsx.booleanize(v).to_s << '"/>')) + v.is_a?(Color) ? v.to_xml_string(str) : (str << '<' << k.to_s << ' val="' << Axlsx.booleanize(v).to_s << '"/>') end str << '' end diff --git a/lib/axlsx/stylesheet/gradient_stop.rb b/lib/axlsx/stylesheet/gradient_stop.rb index 83f39a55..dd0ea00f 100644 --- a/lib/axlsx/stylesheet/gradient_stop.rb +++ b/lib/axlsx/stylesheet/gradient_stop.rb @@ -30,7 +30,7 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = +'') - str << (+'') + str << '' self.color.to_xml_string(str) str << '' end diff --git a/lib/axlsx/stylesheet/pattern_fill.rb b/lib/axlsx/stylesheet/pattern_fill.rb index cabce9f5..9f92dc00 100644 --- a/lib/axlsx/stylesheet/pattern_fill.rb +++ b/lib/axlsx/stylesheet/pattern_fill.rb @@ -59,7 +59,7 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = +'') - str << (+'') + str << '' if fgColor.is_a?(Color) fgColor.to_xml_string str, "fgColor" end diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 809630f2..7b44c023 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -486,7 +486,7 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = +'') - str << (+'') + str << '' instance_vals = Axlsx.instance_values_for(self) [:numFmts, :fonts, :fills, :borders, :cellStyleXfs, :cellXfs, :cellStyles, :dxfs, :tableStyles].each do |key| instance_vals[key.to_s].to_xml_string(str) unless instance_vals[key.to_s].nil? diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 2bd6b648..60da0372 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -174,9 +174,9 @@ module Axlsx def to_xml_string(str = +'') classname = @allowed_types[0].name.split('::').last el_name = serialize_as.to_s || (classname[0, 1].downcase + classname[1..-1]) - str << (+'<' << el_name << ' count="' << size.to_s << '">') + str << '<' << el_name << ' count="' << size.to_s << '">' each { |item| item.to_xml_string(str) } - str << (+'') + str << '' end end end diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb index 4ddcff2c..38669076 100644 --- a/lib/axlsx/workbook/defined_name.rb +++ b/lib/axlsx/workbook/defined_name.rb @@ -123,9 +123,9 @@ module Axlsx def to_xml_string(str = +'') raise ArgumentError, 'you must specify the name for this defined name. Please read the documentation for Axlsx::DefinedName for more details' unless name - str << (+'' << @formula << '') + str << '>' << @formula << '' end end end diff --git a/lib/axlsx/workbook/shared_strings_table.rb b/lib/axlsx/workbook/shared_strings_table.rb index 17007b08..a8086f3e 100644 --- a/lib/axlsx/workbook/shared_strings_table.rb +++ b/lib/axlsx/workbook/shared_strings_table.rb @@ -47,9 +47,9 @@ module Axlsx # @return [String] def to_xml_string(str = +'') Axlsx::sanitize(@shared_xml_string) - str << (+'' << @shared_xml_string << '') + str << '' << @shared_xml_string << '' end private diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index ab16a4ed..3e4927aa 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -408,8 +408,8 @@ module Axlsx def to_xml_string(str = +'') add_worksheet(name: 'Sheet1') unless worksheets.size > 0 str << '' - str << (+'') - str << (+'') + str << '' + str << '' views.to_xml_string(str) str << '' if is_reversed @@ -422,7 +422,7 @@ module Axlsx unless pivot_tables.empty? str << '' pivot_tables.each do |pivot_table| - str << (+'') + str << '' end str << '' end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index f014eb18..16096a52 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -88,7 +88,9 @@ module Axlsx # Serialize the object to xml def to_xml_string(str = +'') - str << "" + str << '' @filter.to_xml_string(str) str << "" end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index 0fc5c968..38bafe85 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -77,7 +77,9 @@ module Axlsx # Serialize the object to xml def to_xml_string(str = +'') - str << "" + str << '' filter_items.each { |filter| filter.to_xml_string(str) } date_group_items.each { |date_group_item| date_group_item.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb index b4c16b57..e1bdf728 100644 --- a/lib/axlsx/workbook/worksheet/cell_serializer.rb +++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb @@ -10,7 +10,7 @@ module Axlsx # @param [String] str The string to apend serialization to. # @return [String] def to_xml_string(row_index, column_index, cell, str = +'') - str << (+'' if cell.value.nil? method = cell.type @@ -30,7 +30,7 @@ module Axlsx elsif cell.contains_rich_text? cell.value.to_xml_string(str) else - str << (+'' << cell.clean_value << '') + str << '' << cell.clean_value << '' end str end @@ -88,8 +88,8 @@ module Axlsx # @param [String] str The string the serialized content will be appended to. # @return [String] def formula_serialization(cell, str = +'') - str << (+'t="str">' << cell.clean_value.to_s.sub('=', '') << '') - str << (+'' << cell.formula_value.to_s << '') unless cell.formula_value.nil? + str << 't="str">' << cell.clean_value.to_s.sub('=', '') << '' + str << '' << cell.formula_value.to_s << '' unless cell.formula_value.nil? end # Serializes cells that are type array formula @@ -97,8 +97,8 @@ module Axlsx # @param [String] str The string the serialized content will be appended to. # @return [String] def array_formula_serialization(cell, str = +'') - str << (+'t="str">' << '' << cell.clean_value.to_s.sub('{=', '').sub(/}$/, '') << '') - str << (+'' << cell.formula_value.to_s << '') unless cell.formula_value.nil? + str << 't="str">' << '' << cell.clean_value.to_s.sub('{=', '').sub(/}$/, '') << '' + str << '' << cell.formula_value.to_s << '' unless cell.formula_value.nil? end # Serializes cells that are type inline_string @@ -158,8 +158,8 @@ module Axlsx end def value_serialization(serialization_type, serialization_value, str = +'') - str << (+'t="' << serialization_type.to_s << '"') if serialization_type - str << (+'>' << serialization_value.to_s << '') + str << 't="' << serialization_type.to_s << '"' if serialization_type + str << '>' << serialization_value.to_s << '' end end end diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb index 2e176f0d..58fe9e10 100644 --- a/lib/axlsx/workbook/worksheet/col_breaks.rb +++ b/lib/axlsx/workbook/worksheet/col_breaks.rb @@ -28,7 +28,7 @@ module Axlsx def to_xml_string(str = +'') return if empty? - str << (+'') + str << '' each { |brk| brk.to_xml_string(str) } str << '' end diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index 1da779aa..ea8324d0 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -63,15 +63,15 @@ module Axlsx # @return [String] def to_xml_string(str = +'') author = @comments.authors[author_index] - str << (+'') + str << '' str << '' unless author.to_s == "" str << '' - str << (+"" << ::CGI.escapeHTML(author.to_s) << ":\n") + str << "" << ::CGI.escapeHTML(author.to_s) << ":\n" end str << '' str << '' - str << (+'' << ::CGI.escapeHTML(text) << '') + str << '' << ::CGI.escapeHTML(text) << '' str << '' end diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb index b121ccd7..cb8efdaa 100644 --- a/lib/axlsx/workbook/worksheet/comments.rb +++ b/lib/axlsx/workbook/worksheet/comments.rb @@ -66,9 +66,9 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') + str << '' authors.each do |author| - str << (+'' << author.to_s << '') + str << '' << author.to_s << '' end str << '' each do |comment| diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index bd5f5bc6..7c05c77e 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -75,8 +75,8 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = +'') - str << (+'') - str << rules.collect { |rule| rule.to_xml_string }.join(' ') + str << '' + rules.each { |rule| rule.to_xml_string(str) } str << '' end end diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb index 1845f327..5d626e46 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb @@ -208,7 +208,7 @@ module Axlsx str << '' - str << (+'' << [*self.formula].join('') << '') if @formula + str << '' << [*self.formula].join('') << '' if @formula @color_scale.to_xml_string(str) if @color_scale && @type == :colorScale @data_bar.to_xml_string(str) if @data_bar && @type == :dataBar @icon_set.to_xml_string(str) if @icon_set && @type == :iconSet diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index 1b9cb46a..d5fa5908 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -237,12 +237,12 @@ module Axlsx valid_attributes = get_valid_attributes str << '' - str << (+'' << self.formula1 << '') if @formula1 and valid_attributes.include?(:formula1) - str << (+'' << self.formula2 << '') if @formula2 and valid_attributes.include?(:formula2) + str << '' << self.formula1 << '' if @formula1 and valid_attributes.include?(:formula1) + str << '' << self.formula2 << '' if @formula2 and valid_attributes.include?(:formula2) str << '' end diff --git a/lib/axlsx/workbook/worksheet/outline_pr.rb b/lib/axlsx/workbook/worksheet/outline_pr.rb index 4cfeea2d..1059ad18 100644 --- a/lib/axlsx/workbook/worksheet/outline_pr.rb +++ b/lib/axlsx/workbook/worksheet/outline_pr.rb @@ -28,7 +28,9 @@ module Axlsx # @param [String] str serialized output will be appended to this object if provided. # @return [String] def to_xml_string(str = +'') - str << "" + str << '' end end end diff --git a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb index 9a2b778b..4291eb38 100644 --- a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +++ b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb @@ -38,7 +38,9 @@ module Axlsx # serialize to xml def to_xml_string(str = +'') - str << (+'') + str << '' end end end diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index e97b8119..27065e4b 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -189,10 +189,10 @@ module Axlsx def to_xml_string(str = +'') str << '' - str << (+'') + str << '' - str << (+'') - str << (+'') + str << '' + str << '' header_cell_values.each do |cell_value| subtotal = !no_subtotals_on_headers.include?(cell_value) @@ -205,12 +205,12 @@ module Axlsx str << '' str << ' ' else - str << (+'') + str << '' rows.each do |row_value| - str << (+'') + str << '' end str << '' - str << (+'') + str << '' rows.size.times do |i| str << '' end @@ -229,16 +229,16 @@ module Axlsx str << '' end else - str << (+'') + str << '' columns.each do |column_value| - str << (+'') + str << '' end str << '' end unless pages.empty? - str << (+'') + str << '' pages.each do |page_value| - str << (+'') + str << '' end str << '' end diff --git a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb index d42c1fda..4928d5ac 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb @@ -47,13 +47,13 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') + str << '' str << '' - str << (+'') + str << '' str << '' - str << (+'') + str << '' pivot_table.header_cells.each do |cell| - str << (+'') + str << '' str << '' str << '' str << '' diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb index ee988318..883d01d3 100644 --- a/lib/axlsx/workbook/worksheet/rich_text_run.rb +++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb @@ -214,15 +214,15 @@ module Axlsx data.keys.each do |key| case key when :font_name - str << (+'') + str << '' when :color str << data[key].to_xml_string else - str << (+'<' << key.to_s << ' val="' << xml_value(data[key]) << '"/>') + str << '<' << key.to_s << ' val="' << xml_value(data[key]) << '"/>' end end clean_value = Axlsx::trust_input ? @value.to_s : ::CGI.escapeHTML(Axlsx::sanitize(@value.to_s)) - str << (+'' << clean_value << '') + str << '' << clean_value << '' end private diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 0c139164..16116835 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -90,9 +90,7 @@ module Axlsx # @return [String] def to_xml_string(r_index, str = +'') serialized_tag('row', str, :r => r_index + 1) do - tmp = +'' # time / memory tradeoff, lots of calls to rubyzip costs more time.. - each_with_index { |cell, c_index| cell.to_xml_string(r_index, c_index, tmp) } - str << tmp + each_with_index { |cell, c_index| cell.to_xml_string(r_index, c_index, str) } end end diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb index 3e945b78..56e8c4c6 100644 --- a/lib/axlsx/workbook/worksheet/row_breaks.rb +++ b/lib/axlsx/workbook/worksheet/row_breaks.rb @@ -26,7 +26,7 @@ module Axlsx def to_xml_string(str = +'') return if empty? - str << (+'') + str << '' each { |brk| brk.to_xml_string(str) } str << '' end diff --git a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb index e85cbf2c..d43198cf 100644 --- a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb @@ -24,7 +24,9 @@ module Axlsx # content to. # @return [String] def to_xml_string(str = +'') - str << "" + str << '' end end end diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index 227b9037..ecf8157f 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -49,7 +49,9 @@ module Axlsx # @param [String] str The string this objects serialization will be appended to # @return [String] def to_xml_string(str = +'') - str << "" + str << '' end private diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index f90e7d6c..86826f77 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -52,7 +52,9 @@ module Axlsx # @return [String] def to_xml_string(str = +'') update_properties - str << "" + str << '' tab_color.to_xml_string(str, 'tabColor') if tab_color outline_pr.to_xml_string(str) if @outline_pr page_setup_pr.to_xml_string(str) diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index 430ef489..210833e0 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -75,12 +75,12 @@ module Axlsx # @return [String] def to_xml_string(str = +'') str << '' - str << (+'') - str << (+'') - str << (+'') + str << '
' + str << '' + str << '' header_cells.each_with_index do |cell, index| - str << (+'') + str << '' end str << '' table_style_info.to_xml_string(str) diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 0a44027f..8c3514cc 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -632,8 +632,8 @@ module Axlsx add_autofilter_defined_name_to_workbook str << '') + str << 'name="' << name << '" ' + str << 'r:id="' << rId << '">' end # Serializes the worksheet object to an xml string -- cgit v1.2.3