summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/row.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-03-28 00:52:30 +0900
committerRandy Morgan <[email protected]>2012-03-28 00:52:30 +0900
commitec9d3b896a2b07cdcb8198c2227df8dac3b83cdb (patch)
treebb0da233e87c50d6560fb236543e6fa2a12fe642 /lib/axlsx/workbook/worksheet/row.rb
parentbe2d7bee9b9236fff4a378db8770c3ae793e8422 (diff)
downloadcaxlsx-ec9d3b896a2b07cdcb8198c2227df8dac3b83cdb.tar.gz
caxlsx-ec9d3b896a2b07cdcb8198c2227df8dac3b83cdb.zip
Still not fast enough?
``` user system total real axlsx_noautowidth 0.760000 0.020000 0.780000 ( 0.885482) axlsx 3.560000 0.130000 3.690000 ( 4.158594) axlsx_shared 11.610000 0.180000 11.790000 ( 13.208945) axlsx_stream 3.450000 0.120000 3.570000 ( 3.920745) csv 0.240000 0.010000 0.250000 ( 0.269822)
Diffstat (limited to 'lib/axlsx/workbook/worksheet/row.rb')
-rw-r--r--lib/axlsx/workbook/worksheet/row.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb
index 30101a28..ac251ed8 100644
--- a/lib/axlsx/workbook/worksheet/row.rb
+++ b/lib/axlsx/workbook/worksheet/row.rb
@@ -59,12 +59,16 @@ module Axlsx
worksheet.rows.index(self)
end
- def to_xml_string
+ def to_xml_string(r_index, str = '')
+ str << '<row r="' << (r_index + 1 ).to_s << '" '
if custom_height?
- '<row r="' << (index+1).to_s << '" customHeight="1" ht="' << height.to_s << '">' << @cells.map { |cell| cell.to_xml_string }.join << '</row>'
+ str << 'customHeight="1" ht="' << height.to_s << '">'
else
- '<row r="' << (index+1).to_s << '">' << (@cells.map { |cell| cell.to_xml_string }.join) << '</row>'
+ str << '>'
end
+ @cells.each_with_index { |cell, c_index| cell.to_xml_string(r_index, c_index, str) }
+ str << '</row>'
+ str
end
# Serializes the row
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.