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')
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')
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' )
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' )
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')
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))