diff --git a/lib/spreadsheet/excel/writer/worksheet.rb b/lib/spreadsheet/excel/writer/worksheet.rb index 08212a3..f626ef2 100644 --- a/lib/spreadsheet/excel/writer/worksheet.rb +++ b/lib/spreadsheet/excel/writer/worksheet.rb @@ -158,7 +158,7 @@ def write_calccount write_op 0x000c, [count].pack('v') end def write_cell type, row, idx, *args - xf_idx = @workbook.xf_index @worksheet.workbook, row.formats[idx] + xf_idx = @workbook.xf_index @worksheet.workbook, row.format(idx) data = [ row.idx, # Index to row idx, # Index to column @@ -358,7 +358,7 @@ def write_eof # Write a cell with a Formula. May write an additional String record depending # on the stored result of the Formula. def write_formula row, idx - xf_idx = @workbook.xf_index @worksheet.workbook, row.formats[idx] + xf_idx = @workbook.xf_index @worksheet.workbook, row.format(idx) cell = row[idx] data1 = [ row.idx, # Index to row @@ -562,7 +562,7 @@ def write_mulblank row, idx, multiples ] # List of nc=lc-fc+1 16-bit indexes to XF records (➜ 6.115) multiples.each_with_index do |blank, cell_idx| - xf_idx = @workbook.xf_index @worksheet.workbook, row.formats[idx + cell_idx] + xf_idx = @workbook.xf_index @worksheet.workbook, row.format(idx + cell_idx) data.push xf_idx end # Index to last column (lc) diff --git a/test/integration.rb b/test/integration.rb index b506650..3a51cb5 100644 --- a/test/integration.rb +++ b/test/integration.rb @@ -580,7 +580,7 @@ def test_change_cell sheet = book.worksheet 0 assert_equal 11, sheet.row_count assert_equal 12, sheet.column_count - useds = [0,0,0,0,0,0,0,1,0,0,11] + useds = [0,0,0,0,0,0,0,0,0,0,0] unuseds = [2,2,1,1,1,2,1,11,1,2,12] sheet.each do |row| assert_equal useds.shift, row.first_used @@ -689,7 +689,7 @@ def test_change_cell__complete_sst_rewrite sheet = book.worksheet 0 assert_equal 11, sheet.row_count assert_equal 12, sheet.column_count - useds = [0,0,0,0,0,0,0,1,0,0,11] + useds = [0,0,0,0,0,0,0,0,0,0,0] unuseds = [2,2,1,1,1,2,1,11,1,2,12] sheet.each do |row| assert_equal useds.shift, row.first_used