Formatting a column or row seems to be no problem. I've poked around the documentation a bunch, did some searches, and looked through the "methods" result on some spreadsheet objects and I can't figure out how to format a specific cell. Has anyone done this?
The Spreadsheet library is here: http://spreadsheet.rubyforge.org/ http://spreadsheet.rubyforge.org/GUIDE_txt.html
Use set_format method:
require 'spreadsheet'
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet
format = Spreadsheet::Format.new :color => :blue,
:weight => :bold,
:size => 18
row = sheet1.row(0)
row[0] = 'test0'
row[1] = 'test1'
row.set_format(0, format) # set format for the first cell
book.write 'C:\\test.xls'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With