Skip to content

Instantly share code, notes, and snippets.

@forforf
Created April 3, 2012 17:51
Show Gist options
  • Select an option

  • Save forforf/2294108 to your computer and use it in GitHub Desktop.

Select an option

Save forforf/2294108 to your computer and use it in GitHub Desktop.
Bug when styling cells when Range ends in zero.
require 'axlsx'
p = Axlsx::Package.new
wb = p.workbook
wb.styles do |s|
head = s.add_style :bg_color => "00", :fg_color => "FF"
wb.add_worksheet(:name => "Bug Example") do |sheet|
sheet.add_row ['This row should not be styled','but it is']
sheet.add_row ['The bug drops the trailing 0', 'so 10 -> 1']
sheet.add_row ['I havent tested to 100 rows', 'so not sure there']
sheet.add_row ['Row', '4']
sheet.add_row ['Row', '5']
sheet.add_row ['Row', '6']
sheet.add_row ['Row', '7']
sheet.add_row ['Row', '8']
sheet.add_row ['Row', '9']
sheet.add_row ['Row', '10']
sheet.add_row ['Row', '11']
sheet["A9:B9"].each {|c| c.style = head}
sheet["A10:B10"].each {|c| c.style = head}
sheet["A11:B11"].each{|c| c.style = head}
end
end
p.serialize "range_bug.xlsx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment