简体   繁体   中英

Axlsx_rails. Set height of multiple rows at once

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?

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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM