Module: Writexlsx::Worksheet::RowColSizing

Includes:
Utility::StringWidth
Included in:
Writexlsx::Worksheet
Defined in:
lib/write_xlsx/worksheet/row_col_sizing.rb

Constant Summary

Constants included from Utility::StringWidth

Utility::StringWidth::CHAR_WIDTHS, Utility::StringWidth::DEFAULT_COL_PIXELS, Utility::StringWidth::MAX_DIGIT_WIDTH, Utility::StringWidth::PADDING

Instance Method Summary collapse

Methods included from Utility::StringWidth

#xl_string_pixel_width

Instance Method Details

#size_col(col, anchor = 0) ⇒ Object

Convert the width of a cell from user’s units to pixels. Excel rounds the column width to the nearest pixel. If the width hasn’t been set by the user we use the default value. A hidden column is treated as having a width of zero unless it has the special “object_position” of 4 (size with cells).



18
19
20
21
22
23
24
25
# File 'lib/write_xlsx/worksheet/row_col_sizing.rb', line 18

def size_col(col, anchor = 0)
  info = col_info[col]
  calculate_col_pixels(
    info&.width,
    info&.hidden,
    anchor
  )
end

#size_row(row, anchor = 0) ⇒ Object

Convert the height of a cell from user’s units to pixels. If the height hasn’t been set by the user we use the default value. A hidden row is treated as having a height of zero unless it has the special “object_position” of 4 (size with cells).



33
34
35
36
37
38
39
40
# File 'lib/write_xlsx/worksheet/row_col_sizing.rb', line 33

def size_row(row, anchor = 0)
  info = row_sizes[row]
  calculate_row_pixels(
    info&.first,
    info&.last,
    anchor
  )
end