summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/axlsx.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/row.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb
index 30683458..bf16afbd 100644
--- a/lib/axlsx.rb
+++ b/lib/axlsx.rb
@@ -125,7 +125,6 @@ module Axlsx
end
chars.prepend((i + 65).chr)
chars.freeze
- chars
end
end
@@ -133,7 +132,8 @@ module Axlsx
# @note The spreadsheet rows are 1-based and the passed in index is 0-based, so we add 1.
# @return [String]
def self.row_ref(index)
- (index + 1).to_s
+ @row_ref ||= {}
+ @row_ref[index] ||= (index + 1).to_s.freeze
end
# @return [String] The alpha(column)numeric(row) reference for this sell.
diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb
index 16116835..dc0320b7 100644
--- a/lib/axlsx/workbook/worksheet/row.rb
+++ b/lib/axlsx/workbook/worksheet/row.rb
@@ -89,7 +89,7 @@ module Axlsx
# @param [String] str The string this rows xml will be appended to.
# @return [String]
def to_xml_string(r_index, str = +'')
- serialized_tag('row', str, :r => r_index + 1) do
+ serialized_tag('row', str, :r => Axlsx.row_ref(r_index)) do
each_with_index { |cell, c_index| cell.to_xml_string(r_index, c_index, str) }
end
end