Commit da71d9f8 by liyijie

merge logic fix

parent aec701ab
...@@ -91,9 +91,9 @@ module TalltyImportExport ...@@ -91,9 +91,9 @@ module TalltyImportExport
headers.each_with_index do |header, col_index| headers.each_with_index do |header, col_index|
_data = handle_data(record, header, index) _data = handle_data(record, header, index)
if header[:merge].present? && last_row.present? && _data == last_row[col_index] if header[:merge].present? && last_row.present? && _data == last_row[col_index]
merge_index = merge_column_hash[col_index] || [] merge_column_hash[col_index] ||= []
merge_index << index + first_content_row_index merge_column_hash[col_index] << index + first_content_row_index
merge_index << index + first_content_row_index + 1 merge_column_hash[col_index] << index + first_content_row_index + 1
end end
row.push(_data) row.push(_data)
end end
...@@ -105,7 +105,7 @@ module TalltyImportExport ...@@ -105,7 +105,7 @@ module TalltyImportExport
merge_column_hash.each do |col_index, row_arr| merge_column_hash.each do |col_index, row_arr|
split_arr(row_arr).each do |arr| split_arr(row_arr).each do |arr|
sheet.merge_cells( sheet.merge_cells(
Axlsx::cell_r(arr.first, col_index) + ':' + Axlsx::cell_r(arr.last, col_index) Axlsx::cell_r(col_index, arr.first) + ':' + Axlsx::cell_r(col_index, arr.last)
) )
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment