Method: Axlsx::Col#update_width

Defined in:
lib/axlsx/workbook/worksheet/col.rb

#update_width(cell, fixed_width = nil, use_autowidth = true) ⇒ Object

updates the width for this col based on the cells autowidth and an optionally specified fixed width to this value and the cell's attributes are ignored. autowidth value will be ignored.

Parameters:

  • cell (Cell)

    The cell to use in updating this col's width

  • fixed_width (Integer) (defaults to: nil)

    If this is specified the width is set

  • use_autowidth (Boolean) (defaults to: true)

    If this is false, the cell's



124
125
126
127
128
129
130
131
132
# File 'lib/axlsx/workbook/worksheet/col.rb', line 124

def update_width(cell, fixed_width=nil, use_autowidth=true)
   if fixed_width.is_a? Numeric
     self.width = fixed_width
   elsif use_autowidth
     cell_width = cell.autowidth
     self.width = cell_width unless (width || 0) > (cell_width || 0)
     #self.width = [width || 0, cell.autowidth || 0].max
   end 
end