diff options
| author | Randy Morgan <[email protected]> | 2012-03-26 04:17:55 -0700 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-03-26 04:17:55 -0700 |
| commit | b07ea515f85c9314ca4fa981cb9267693effa821 (patch) | |
| tree | 1fc548ff843cbce5e06db0c6133407f503d3e78c /lib | |
| parent | 42f45f4138a1f71b19411fd8600f2a2bce67a46b (diff) | |
| parent | f6c3a491ef014914524a98259a8679a5e4f64d57 (diff) | |
| download | caxlsx-b07ea515f85c9314ca4fa981cb9267693effa821.tar.gz caxlsx-b07ea515f85c9314ca4fa981cb9267693effa821.zip | |
Merge pull request #64 from ochko/go-faster
Go faster
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/row.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index db7a56e5..cec2eb25 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -63,7 +63,7 @@ module Axlsx if custom_height? "<row r=\"%s\" customHeight=\"1\" ht=\"%s\">%s</row>" % [index+1, height, @cells.inject("") { |memo, obj| obj.to_xml_string }] else - "<row r=\"%s\">%s</row>" % [index+1, @cells.inject("") { |memo, obj| memo.concat obj.to_xml_string }] + "<row r=\"%s\">%s</row>" % [index+1, @cells.map{ |obj| obj.to_xml_string }.join] end end # Serializes the row diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 1d128235..a85da6fc 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -386,7 +386,7 @@ module Axlsx str.concat '</cols>' end - str.concat "<sheetData>%s</sheetData>" % [@rows.reduce('') { |memo, obj| memo += obj.to_xml_string }] + str.concat "<sheetData>%s</sheetData>" % @rows.map { |obj| obj.to_xml_string }.join str.concat page_margins.to_xml_string if @page_margins str.concat "<autoFilter ref='%s'></autoFilter>" % @auto_filter if @auto_filter str.concat "<mergeCells count='%s'>%s</mergeCells>" % [@merged_cells.size, @merged_cells.reduce('') { |memo, obj| "<mergeCell ref='%s'></mergeCell>" % obj } ] unless @merged_cells.empty? @@ -493,6 +493,7 @@ module Axlsx # @param [Array] cells an array of cells # @param [Array] widths an array of cell widths @see Worksheet#add_row def update_auto_fit_data(cells, widths=[]) + return cells unless self.workbook.use_autowidth # TODO delay this until rendering. too much work when we dont know what they are going to do to the sheet. styles = self.workbook.styles cellXfs, fonts = styles.cellXfs, styles.fonts |
