rubyXL
rubyXL copied to clipboard
get_column_width_raw() handling default widths
I'm doing some pixel calculations using, so I use get_column_width_raw()
. This works well, except for columns that have a defaut width. In this case, get_column_width_raw()
returns null.
I've looked at the code for get_column_width()
, it does handle default column widths, but not in pixel. Am I missing something? Is there any way for get_column_width_raw()
to handle defaults widths? Would the following work?
def get_column_width_raw(column_index = 0)
validate_workbook
validate_nonnegative(column_index)
range = cols.locate_range(column_index)
if range
range.width
else
RubyXL::ColumnRange::DEFAULT_WIDTH + 5.0 / RubyXL::Font::MAX_DIGIT_WIDTH
end
end