I'm creating a spreadsheet using the axlsx gem. I'd like to set fixed width to on all spreadsheet columns and I need to call the function
def column_widths(*widths)
widths.each_with_index do |value, index|
next if value == nil
Axlsx::validate_unsigned_numeric(value) unless value == nil
find_or_create_column_info(index).width = value
end
end
defined in the Axlsx::Worksheet with an arbitrary number of column widths. E.g. `sheet.column_width(20, 20, ..., 20). My method call looks like
sheet.column_widths [20]*headers.length
and it result in the error
ActionView::Template::Error (Invalid Data [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20] for Invalid column width. must be [Fixnum, Integer, Float].
How can I dynamically create a proper method call for the unknown number of columns?
sheet.column_widths(*[20]*headers.length)?