3

I'm generating *.xlsx files using axlsx_rails based on xlsx gem.

I'm setting height for single row like this:

sheet.add_row [1,2,3,4,5,6], :style => predefined_style, :height => 14.3

How could I set height for a batch of rows, and if it possible, which declaration has higher priority?

vvahans
  • 1,849
  • 21
  • 29

1 Answers1

6

The best I know of is to set the height on each row:

sheet.rows.values_at(1,2,5,6).each {|row| row.height = 40}

If necessary you can gain access to the sheets through the workbook:

sheet = workbook.worksheets.first
# or
sheet = workbook.sheet_by_name("Sheet Name")

Whichever statement comes later has priority (meaning it isn't like CSS where inline has higher priority.)

noel
  • 2,095
  • 14
  • 14