Skip to content

Commit

Permalink
Honor Row, Column, Worksheet and Workbook-formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Wyss authored and hannes-wyss committed Feb 13, 2009
1 parent e1bab45 commit 5b6fe8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/spreadsheet/excel/writer/worksheet.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/integration.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5b6fe8c

Please sign in to comment.