Module: Writexlsx::Utility::Dimensions

Includes:
Constants
Included in:
ObjectPositioning, Package::ConditionalFormat, Package::Table, Worksheet::DataValidation
Defined in:
lib/write_xlsx/utility/dimensions.rb

Constant Summary

Constants included from Constants

Constants::COL_MAX, Constants::ROW_MAX, Constants::SHEETNAME_MAX, Constants::STR_MAX

Instance Method Summary collapse

Instance Method Details

#check_dimensions(row, col) ⇒ Object



11
12
13
14
15
# File 'lib/write_xlsx/utility/dimensions.rb', line 11

def check_dimensions(row, col)
  raise WriteXLSXDimensionError if !row || row >= ROW_MAX || !col || col >= COL_MAX

  0
end

#check_dimensions_and_update_max_min_values(row, col, ignore_row = 0, ignore_col = 0) ⇒ Object

Check that row and col are valid and store max and min values for use in other methods/elements.



21
22
23
24
25
26
27
# File 'lib/write_xlsx/utility/dimensions.rb', line 21

def check_dimensions_and_update_max_min_values(row, col, ignore_row = 0, ignore_col = 0)       # :nodoc:
  check_dimensions(row, col)
  store_row_max_min_values(row) if ignore_row == 0
  store_col_max_min_values(col) if ignore_col == 0

  0
end

#store_col_max_min_values(col) ⇒ Object



34
35
36
37
# File 'lib/write_xlsx/utility/dimensions.rb', line 34

def store_col_max_min_values(col)
  @dim_colmin = col if !@dim_colmin || (col < @dim_colmin)
  @dim_colmax = col if !@dim_colmax || (col > @dim_colmax)
end

#store_row_max_min_values(row) ⇒ Object



29
30
31
32
# File 'lib/write_xlsx/utility/dimensions.rb', line 29

def store_row_max_min_values(row)
  @dim_rowmin = row if !@dim_rowmin || (row < @dim_rowmin)
  @dim_rowmax = row if !@dim_rowmax || (row > @dim_rowmax)
end