Example #1
0
 def apply_alignment(self, worksheet, value, column_number, row_number):
     if isinstance(value, Alignment):
         worksheet[ExcelFile.get_idx(column_number,
                                     row_number)].alignment = value
     else:
         raise ValueError(
             'font option must be is instance of openpyxl.styles.Alignment')
Example #2
0
 def apply_border(self, worksheet, value, column_number, row_number):
     if isinstance(value, Border):
         worksheet[ExcelFile.get_idx(column_number,
                                     row_number)].border = value
     else:
         raise ValueError(
             'font option must be is instance of openpyxl.styles.Border')
Example #3
0
 def apply_protection(self, worksheet, value, column_number, row_number):
     if isinstance(value, Protection):
         worksheet[ExcelFile.get_idx(column_number,
                                     row_number)].protection = value
     else:
         raise ValueError(
             'font option must be is instance of openpyxl.styles.Protection'
         )
Example #4
0
 def apply_fill(self, worksheet, value, column_number, row_number):
     if isinstance(value, PatternFill):
         worksheet[ExcelFile.get_idx(column_number,
                                     row_number)].fill = value
     else:
         raise ValueError(
             'font option must be is instance of openpyxl.styles.PatternFill'
         )
Example #5
0
 def apply_number_format(self, worksheet, value, column_number, row_number):
     if isinstance(value, str):
         worksheet[ExcelFile.get_idx(column_number,
                                     row_number)].number_format = value
     else:
         raise ValueError('font option must be is instance of Str')
Example #6
0
 def apply_rowspan(self, worksheet, value, column_number, row_number):
     from_idx = ExcelFile.get_idx(column_number, row_number)
     to_idx = ExcelFile.get_idx(column_number, row_number + value - 1)
     worksheet.merge_cells('{from_cell}:{to_cell}'.format(
         from_cell=from_idx, to_cell=to_idx))