2011-05-13 92 views

回答

14

使用set_format方法:

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' 
相關問題