Example #1
0
    def get_column(self) -> int:
        """Get column number

        Returns:
            int: Row number
        """
        raise XlFormNotImplementedException()
Example #2
0
    def get_formula(self) -> CellValue:
        """Get formul(

        Returns:
            CellValue: Formula
        """
        raise XlFormNotImplementedException()
Example #3
0
    def new_book(self) -> Book:
        """New book

        Returns:
            Book: Book
        """
        raise XlFormNotImplementedException()
Example #4
0
    def iter_sheets(self) -> Iterator[Sheet]:
        """Get sheets iterator

        Returns:
            Iterator[Sheet]: Sheets
        """
        raise XlFormNotImplementedException()
Example #5
0
    def add_sheet(self, name: str) -> None:
        """Add sheet

        Args:
            name (str): Sheet name
        """
        raise XlFormNotImplementedException()
Example #6
0
    def save(self, path: Path) -> None:
        """Save book

        Args:
            path (Path): File path
        """
        raise XlFormNotImplementedException()
Example #7
0
    def get_number_format(self) -> str:
        """Get number format

        Returns:
            str: Number format
        """
        raise XlFormNotImplementedException()
Example #8
0
    def set_value(self, value: CellValue) -> None:
        """Set cell value

        Args:
            value (CellValue): Cell value
        """
        raise XlFormNotImplementedException()
Example #9
0
    def get_name(self) -> str:
        """Get sheet name

        Returns:
            str: Sheet name
        """
        raise XlFormNotImplementedException()
Example #10
0
    def get_columns_count(self) -> int:
        """Get columns count

        Returns:
            int: Columns count
        """
        raise XlFormNotImplementedException()
Example #11
0
    def get_rows_count(self) -> int:
        """Get rows count

        Returns:
            int: Rows count
        """
        raise XlFormNotImplementedException()
Example #12
0
    def open_book(self, path: Path) -> Book:
        """Open book

        Args:
            path (Path): File path

        Returns:
            Book: Book
        """
        raise XlFormNotImplementedException()
Example #13
0
    def get_text(self) -> str:
        """Get text

        Raise an exception if the formula cannot be analyzed.
        Raise an exception if the number format cannot be analyzed.

        Returns:
            str: Text
        """
        raise XlFormNotImplementedException()
Example #14
0
    def get_range(self, arg: str) -> Range:
        """Get range

        Args:
            arg (str): range like 'A1', 'A1:C3'

        Returns:
            Range: Range
        """
        raise XlFormNotImplementedException()
Example #15
0
    def get_cell(self, row: int, column: int) -> Cell:
        """Get cell

        Args:
            row (int): Row index starting from 1
            column (int): Column index starting from 1

        Returns:
            Cell: Cell
        """
        raise XlFormNotImplementedException()
Example #16
0
    def get_value(self) -> CellValue:
        """Get value

        If there is a formula, the calculation result is returned as a value.
        Otherwise, the value is returned.

        Raise an exception if the formula cannot be analyzed.

        Returns:
            CellValue: Value
        """
        raise XlFormNotImplementedException()
Example #17
0
    def get_address(
        self, column_absolute: bool = True, row_absolute: bool = True
    ) -> str:
        """Get cell address

        Args:
            column_absolute (bool, optional): True if column absolute
            row_absolute (bool, optional): True if row absolute

        Returns:
            str: A1 style absolute address like '$A$1'
        """
        raise XlFormNotImplementedException()
Example #18
0
    def _set_item_doc(self, item_doc: ItemDoc) -> None:
        sheet = self._find_sheet(self._sheet_name)
        r = sheet.get_range(self._range_arg)

        result = item_doc.get_result()
        if isinstance(result, list):
            rows_count = len(result)
            if r.get_rows_count() - self._header_rows_count != rows_count:
                raise XlFormArgumentException()
            for row in result:
                if len(row) != r.get_columns_count():
                    raise XlFormArgumentException()

            for row_index, row in enumerate(result, start=1):
                for col_index, value in enumerate(row, start=1):
                    r.get_cell(row_index, col_index).set_value(value)

        elif isinstance(result, dict):
            raise XlFormNotImplementedException()
Example #19
0
 def _validate_book(self) -> None:
     sheet = self._find_sheet(self._sheet_name)
     r = sheet.get_range(self._range_arg)
     if r.get_rows_count() <= self._header_rows_count:
         raise XlFormValidationException()
     if r.get_columns_count() <= 0:
         raise XlFormInternalException()
     if self._header_rows_count == 0:
         pass
     elif self._header_rows_count >= 1:
         if self._header_path_list is None:
             raise XlFormInternalException()
         if len(self._header_path_list) != r.get_columns_count():
             raise XlFormArgumentException(
                 "len(self._header_path_list) != r.get_columns_count()"
             )
         for col_index, header_path in enumerate(
             self._header_path_list, start=1
         ):
             for row_index, header in enumerate(header_path, start=1):
                 if r.get_cell(row_index, col_index).get_value() != header:
                     XlFormValidationException()
     else:
         raise XlFormNotImplementedException()
Example #20
0
 def _set_item_doc(self, item_doc: ItemDoc) -> None:
     """Set item document to book"""
     raise XlFormNotImplementedException()
Example #21
0
 def _get_item_doc(self) -> ItemDoc:
     """Get item document from book"""
     raise XlFormNotImplementedException()
Example #22
0
 def _validate_item_doc(self, item_doc: ItemDoc) -> None:
     """Validate item document"""
     raise XlFormNotImplementedException()
Example #23
0
 def _validate_book(self) -> None:
     """Validate book"""
     raise XlFormNotImplementedException()
Example #24
0
 def get_text(self) -> str:
     raise XlFormNotImplementedException()
Example #25
0
 def get_value(self) -> CellValue:
     value = safe_cast_cell_value(self._cell.value)
     if isinstance(value, str) and value[0] == "=":
         raise XlFormNotImplementedException()
     return value
Example #26
0
 def unprotect(self) -> None:
     if False:
         self._sheet.protection.disable()
     raise XlFormNotImplementedException()
Example #27
0
 def _set_item_doc(self, item_doc: ItemDoc) -> None:
     raise XlFormNotImplementedException()
Example #28
0
 def unprotect(self) -> None:
     """Unprotect"""
     raise XlFormNotImplementedException()
Example #29
0
 def calculate(self) -> None:
     """Calculate"""
     raise XlFormNotImplementedException()
Example #30
0
 def close(self) -> None:
     """Close book"""
     raise XlFormNotImplementedException()