MCPcopy
hub / github.com/jmcnamara/XlsxWriter / _check_dimensions

Method _check_dimensions

xlsxwriter/worksheet.py:4973–5006  ·  view source on GitHub ↗
(
        self, row: int, col: int, ignore_row=False, ignore_col=False
    )

Source from the content-addressed store, hash-verified

4971 self._xml_close()
4972
4973 def _check_dimensions(
4974 self, row: int, col: int, ignore_row=False, ignore_col=False
4975 ) -> int:
4976 # Check that row and col are valid and store the max and min
4977 # values for use in other methods/elements. The ignore_row /
4978 # ignore_col flags is used to indicate that we wish to perform
4979 # the dimension check without storing the value. The ignore
4980 # flags are use by set_row() and data_validate.
4981
4982 # Check that the row/col are within the worksheet bounds.
4983 if row < 0 or col < 0:
4984 return -1
4985 if row >= self.xls_rowmax or col >= self.xls_colmax:
4986 return -1
4987
4988 # In constant_memory mode we don't change dimensions for rows
4989 # that are already written.
4990 if not ignore_row and not ignore_col and self.constant_memory:
4991 if row < self.previous_row:
4992 return -2
4993
4994 if not ignore_row:
4995 if self.dim_rowmin is None or row < self.dim_rowmin:
4996 self.dim_rowmin = row
4997 if self.dim_rowmax is None or row > self.dim_rowmax:
4998 self.dim_rowmax = row
4999
5000 if not ignore_col:
5001 if self.dim_colmin is None or col < self.dim_colmin:
5002 self.dim_colmin = col
5003 if self.dim_colmax is None or col > self.dim_colmax:
5004 self.dim_colmax = col
5005
5006 return 0
5007
5008 def _convert_date_time(self, dt_obj):
5009 # Convert a datetime object to an Excel serial date and time.

Callers 15

_write_stringMethod · 0.95
_write_numberMethod · 0.95
_write_blankMethod · 0.95
_write_formulaMethod · 0.95
_write_array_formulaMethod · 0.95
_write_datetimeMethod · 0.95
_write_booleanMethod · 0.95
_write_urlMethod · 0.95
_write_rich_stringMethod · 0.95
insert_imageMethod · 0.95
embed_imageMethod · 0.95
insert_textboxMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected