create my_products_stat_excel

This commit is contained in:
7nimor
2025-08-03 13:56:59 +03:30
parent 275b84467e
commit ddc434d63e
4 changed files with 163 additions and 10 deletions

View File

@@ -139,6 +139,11 @@ def create_value(worksheet, list, l, num, border_style=None, m=None, height=None
for item in range(len(list)):
cell = worksheet.cell(row=l, column=item + num, value=list[item])
cell.alignment = Alignment_CELL
if height is not None:
worksheet.row_dimensions[l].height = height
if width is not None:
worksheet.column_dimensions[openpyxl.utils.get_column_letter(item + num)].width = width
if border_style:
cell.border = openpyxl.styles.Border(
@@ -162,9 +167,6 @@ def create_value(worksheet, list, l, num, border_style=None, m=None, height=None
else:
cell.fill = PatternFill(start_color="FAF0E7", fill_type="solid")
if height is not None:
worksheet.row_dimensions[l + 1].height = height
if item_num is not None and item == item_num:
if item_color:
cell.fill = item_color
@@ -174,9 +176,6 @@ def create_value(worksheet, list, l, num, border_style=None, m=None, height=None
if different_cell is not None and list[different_cell] == different_value:
cell.fill = RED_CELL
if width is not None:
worksheet.column_dimensions[openpyxl.utils.get_column_letter(item + num)].width = width
def merge_cells(worksheet, l, s, cell1=None, cell2=None, lst=None):
if lst is not None:
@@ -311,4 +310,4 @@ def convert_str_to_date(string):
try:
return datetime.strptime(string, '%Y-%m-%d').date()
except ValueError:
return None
return None