diff options
| author | Jurriaan Pruis <[email protected]> | 2014-03-04 23:11:17 +0100 |
|---|---|---|
| committer | Jurriaan Pruis <[email protected]> | 2014-03-04 23:11:17 +0100 |
| commit | 758d3a457bac0358724150a893d1df16cd60b5b4 (patch) | |
| tree | f7ddd83a131dc39cf514f0bc17d49fdafbadc99e /lib | |
| parent | b0c524ed2fb071ecb61f2b5b790462427e9b560d (diff) | |
| download | caxlsx-758d3a457bac0358724150a893d1df16cd60b5b4.tar.gz caxlsx-758d3a457bac0358724150a893d1df16cd60b5b4.zip | |
Fix cell merging, #179
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 8dec8e92..3ecc73d7 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -307,12 +307,12 @@ module Axlsx # @see worksheet.merge_cells # @param [Cell, String] target The last cell, or str ref for the cell in the merge range def merge(target) - range_end = if target.is_a?(String) - target - elsif(target.is_a?(Cell)) - target.r - end - self.row.worksheet.merge_cells "#{self.r}:#{range_end}" unless range_end.nil? + start, stop = if target.is_a?(String) + [self.r, target] + elsif(target.is_a?(Cell)) + Axlsx.sort_cells([self, target]).map { |c| c.r } + end + self.row.worksheet.merge_cells "#{start}:#{stop}" unless stop.nil? end # Serializes the cell |
