An attempt to create an excel style - the color of ruby background row of the table , but nothing happens to me -
Here is my code -
My formats:
pass_format = Spreadsheet::Format.new :color=> :blue, :pattern_fg_color => :green, :pattern => 1
fail_format = Spreadsheet::Format.new :color=> :blue, :pattern_fg_color => :red, :pattern => 1
skip_format = Spreadsheet::Format.new :color=> :blue, :pattern_fg_color => :yellow, :pattern => 1
Trying to use them here (just showing one rest is determined by if elses):
sheet1.row(counter).default_format = skip_format
sheet1[counter, 3] = 'Skipped'
sheet1.row(counter).default_format = skip_format
sheet1.row(counter).set_format(3, skip_format)
The counter is the line I'm in now. Here I am not sure whether to format or write first. What am I doing wrong? How to fix it?
This actually applies as I found from .inspect -
but even if it shows red here, in black .: (
I edit the source file and then write in a new file as
book.write "Result.xls"
Is this the wrong approach? Before editing and updating, I will try to create a new book.