(
self, row: int, col: int, string: str, cell_format: Optional[Format] = None
)
| 596 | |
| 597 | # Undecorated version of write_string(). |
| 598 | def _write_string( |
| 599 | self, row: int, col: int, string: str, cell_format: Optional[Format] = None |
| 600 | ) -> Literal[0, -1, -2]: |
| 601 | str_error = 0 |
| 602 | |
| 603 | # Check that row and col are valid and store max and min values. |
| 604 | if self._check_dimensions(row, col): |
| 605 | return -1 |
| 606 | |
| 607 | # Check that the string is < 32767 chars. |
| 608 | if len(string) > self.xls_strmax: |
| 609 | string = string[: self.xls_strmax] |
| 610 | str_error = -2 |
| 611 | |
| 612 | # Write a shared string or an in-line string in constant_memory mode. |
| 613 | if not self.constant_memory: |
| 614 | string_index = self.str_table._get_shared_string_index(string) |
| 615 | else: |
| 616 | string_index = string |
| 617 | |
| 618 | # Write previous row if in in-line string constant_memory mode. |
| 619 | if self.constant_memory and row > self.previous_row: |
| 620 | self._write_single_row(row) |
| 621 | |
| 622 | # Store the cell data in the worksheet data table. |
| 623 | self.table[row][col] = CellStringTuple(string_index, cell_format) |
| 624 | |
| 625 | return str_error |
| 626 | |
| 627 | @convert_cell_args |
| 628 | def write_number( |
no test coverage detected