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

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

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

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

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

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

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

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

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

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

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

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

        Args:
            path (Path): File path

        Returns:
            Book: Book
        """
        raise XlFormNotImplementedException()
Beispiel #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()
Beispiel #14
0
    def get_range(self, arg: str) -> Range:
        """Get range

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

        Returns:
            Range: Range
        """
        raise XlFormNotImplementedException()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #20
0
 def _set_item_doc(self, item_doc: ItemDoc) -> None:
     """Set item document to book"""
     raise XlFormNotImplementedException()
Beispiel #21
0
 def _get_item_doc(self) -> ItemDoc:
     """Get item document from book"""
     raise XlFormNotImplementedException()
Beispiel #22
0
 def _validate_item_doc(self, item_doc: ItemDoc) -> None:
     """Validate item document"""
     raise XlFormNotImplementedException()
Beispiel #23
0
 def _validate_book(self) -> None:
     """Validate book"""
     raise XlFormNotImplementedException()
Beispiel #24
0
 def get_text(self) -> str:
     raise XlFormNotImplementedException()
Beispiel #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
Beispiel #26
0
 def unprotect(self) -> None:
     if False:
         self._sheet.protection.disable()
     raise XlFormNotImplementedException()
Beispiel #27
0
 def _set_item_doc(self, item_doc: ItemDoc) -> None:
     raise XlFormNotImplementedException()
Beispiel #28
0
 def unprotect(self) -> None:
     """Unprotect"""
     raise XlFormNotImplementedException()
Beispiel #29
0
 def calculate(self) -> None:
     """Calculate"""
     raise XlFormNotImplementedException()
Beispiel #30
0
 def close(self) -> None:
     """Close book"""
     raise XlFormNotImplementedException()