I am trying to set the background-color for a table. it works well with this code. But if my workbook has more then 3 sheets, the set_format will not work on third sheet row(8) 4th cell. All formatting will not work from there on. every xls file generated has the same result. it stops at that particular cell all the rest of the workbook has no more styling. Any suggestion?
please see the attached picture.
def make_xls
book = Spreadsheet::Workbook.new
sheet = book.create_worksheet
4.times { |x| sheet.column(x).width = 30 }
4.times { |x| sheet.row(0).set_format(x, title_format) }
4.times { |x| sheet.row(1).set_format(x, header_format) }
4.times { |x| sheet.row(7).set_format(x, title_format) }
4.times { |x| sheet.row(8).set_format(x, header_format) }
insert_values..
end
def title_format
Spreadsheet::Format.new(
weight: :bold,
pattern: 1,
pattern_fg_color: :silver
)
end
def header_format
Spreadsheet::Format.new(
color: :white,
pattern: 1,
pattern_fg_color: :xls_color_48,
weight: :bold
)
end
Any suggestion is appreciated, I am using spreadsheet (1.2.6), RoR6.