Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
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


Thread View

Thread Author Date
Setting Background colorCorey Martella2009-01-06 02:34
      RE: Setting Background colorHannes Wyss2009-01-14 08:11
      RE: Setting Background colorHannes Wyss2009-01-14 16:48
            RE: Setting Background colorBraden Wright2009-10-14 16:37
      RE: Setting Background colorJavix 2010-03-03 11:57
            RE: Setting Background colorJavix 2010-03-04 15:15

Post a followup to this message