Prev | Current Page 90 | Next

David Berube

"Practical Reporting with Ruby and Rails"

)
Next, you start looping through all of the players, first outputting a brief name and
header for each player:
Player.find(:all).each do |player|
worksheet.format_row(current_row, current_row==1 ? 20 : 33, player_name_format)
worksheet.write(current_row, 0, player.name)
current_row=current_row+1
worksheet.write(current_row, 0, ['Game', 'Wins', 'Losses'], header_format)
current_row=current_row+1
The second line uses the format_row method, which is much like the format_column
method, except that it formats rows rather than columns. You format the first row, giving
it a special format defined earlier, player_name_format, and giving it a variable height,
depending on whether it??™s the second row or another row. The second row is the row
immediately following the page header (which is in a font twice the size of the data rows),
and it looks better with less vertical space.
Next, you write the player name to the first column of your current row and increment
your current_row counter.
nNote The need to increment the current_row counter gets somewhat tedious.


Pages:
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
aquilamed mallow.histod.pl fotele i krzesła biurowe usługi remontowe łódź Piaskowanie