Prev | Current Page 87 | Next

David Berube

"Practical Reporting with Ruby and Rails"

Next, you start creating the Excel
report using the spreadsheet-excel gem:
require 'spreadsheet/excel'
include Spreadsheet
workbook = Excel.new("spreadsheet_report.xls")
worksheet = workbook.add_worksheet
CHAPTER 4 n CREATING REPORTS ON THE DESKTOP 56
The first line loads the spreadsheet/excel library, and the second line mixes the
spreadsheet/excel code into your current module so you can use it. Next, you create a
new Excel document, which is called a worksheet, and then add a new worksheet to the
workbook. The worksheet will contain your report.
nNote You can add more than one worksheet to a workbook if desired. Then your end users will be able to
select between them using tabs at the bottom of their spreadsheet application.
Next, you set up some graphical formatting for your data:
page_header_format = Format.new(:color=>'black', :bold=>true, :size=>30)
player_name_format = Format.new(:color=>'black', :bold=>true)
header_format = Format.new(:color=>'gray', :bold=>true)
data_format = Format.new(:color=>'black', :bold=>false)
workbook.


Pages:
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
ochrona czujnik temperatury baseny ogrodowe Ustawy Nr1 Stroiki ślubne