diff options
| author | Tobias Egli <[email protected]> | 2022-02-02 16:00:32 +0100 |
|---|---|---|
| committer | Josef Šimánek <[email protected]> | 2022-02-06 00:37:27 +0100 |
| commit | d3cf7bca5728b166c7643ad839efeba60ed0e256 (patch) | |
| tree | 9175590f74a43cd394d22b03da1788eef7a7d2af /lib/axlsx/workbook/worksheet/col.rb | |
| parent | 059c9d38c8860775a260711f78222b69535e6163 (diff) | |
| download | caxlsx-d3cf7bca5728b166c7643ad839efeba60ed0e256.tar.gz caxlsx-d3cf7bca5728b166c7643ad839efeba60ed0e256.zip | |
Autowidth cell calculation is now configurable
On the workbook you can now configure the font_scale_divisor and the bold_font_multiplier to get better results for the automatic cell width calculationb
Diffstat (limited to 'lib/axlsx/workbook/worksheet/col.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/col.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index 95204028..3b3775c4 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -125,12 +125,12 @@ module Axlsx # to this value and the cell's attributes are ignored. # @param [Boolean] use_autowidth If this is false, the cell's # autowidth value will be ignored. - def update_width(cell, fixed_width=nil, use_autowidth=true) + def update_width(cell, fixed_width = nil, use_autowidth = true) if fixed_width.is_a? Numeric - self.width = fixed_width + self.width = fixed_width elsif use_autowidth - cell_width = cell.autowidth - self.width = cell_width unless (width || 0) > (cell_width || 0) + cell_width = cell.autowidth + self.width = cell_width unless (width || 0) > (cell_width || 0) end end |
