486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
# File 'lib/fast_excel.rb', line 486
def add_text_width(value, format, cell_number)
font_size = 0
if format
font_size = format.font_size
end
if font_size == 0
if @col_formats[cell_number] && @col_formats[cell_number].font_size
font_size = @col_formats[cell_number].font_size
end
end
if font_size == 0
font_size = workbook.default_format.font_size
end
font_size = 13 if font_size == nil || font_size == 0
scale = 0.08
new_width = (scale * font_size * value.to_s.length )
@column_widths[cell_number] = if new_width > (@column_widths[cell_number] || 0)
new_width
else
@column_widths[cell_number]
end
end
|