| Message: 63651 |
 |
BY: Corey Martella (cmartella) DATE: 2009-01-06 02:34 SUBJECT: Setting Background color I'm trying to format a cell to solid black using your spreadsheet gem but on Office for Mac I can't seem to get the desired output.
Basically I want to cell all the cells of a column except the first. Here is the appropriate snippets, any ideas/suggestions what I'm doing wrong?
book = Spreadsheet::Workbook.new
blacked_out_format = Spreadsheet::Format.new :pattern_bg_color => "black", :pattern_fg_color => "black", :pattern => 1
book.add_format blacked_out_format
sheet = book.create_worksheet :name => "..."
blacked_out_columns = [1,3,5]
# do some stuff to build row(0)
(1..20).each_with_index do |employee,i|
sheet[i+1,0] = "Employee #{i}"
blacked_out_columns.each do |col|
sheet.row(i+1).set_format(col,blacked_out_format)
end
end
#write the book to a file
| |