create detail_quota_excel
This commit is contained in:
@@ -43,22 +43,27 @@ def shamsi_date(date, in_value=None):
|
||||
return sh_date
|
||||
|
||||
|
||||
def create_header(worksheet, list, num, row, height=None, width=None, color=None, text_color=None, border_style=None):
|
||||
def create_header(worksheet, list, num, row, height=None, width=None, color=None, text_color=None, border_style=None,
|
||||
different_color=None):
|
||||
for col_num, option in enumerate(list, num):
|
||||
cell = worksheet.cell(row=row, column=col_num, value=option)
|
||||
col_letter = get_column_letter(col_num)
|
||||
cell.alignment = Alignment_CELL
|
||||
if color is not None:
|
||||
if color == 'green':
|
||||
cell.fill = GREEN_CELL
|
||||
elif color == 'orange':
|
||||
cell.fill = ORANGE_CELL
|
||||
elif color == 'blue':
|
||||
cell.fill = BLUE_CELL
|
||||
else:
|
||||
cell.fill = PatternFill(start_color=color, fill_type="solid")
|
||||
color_dict = {
|
||||
'green': GREEN_CELL,
|
||||
'yellow': YELLOW_CELL,
|
||||
'blue': BLUE_CELL,
|
||||
'red': RED_CELL,
|
||||
'light_green': LIGHT_GREEN_CELL,
|
||||
'very_light_green': VERY_LIGHT_GREEN_CELL,
|
||||
'gray': GRAY_CELL
|
||||
}
|
||||
if color in color_dict:
|
||||
cell.fill = color_dict[color]
|
||||
else:
|
||||
cell.fill = CREAM_CELL
|
||||
if different_color:
|
||||
cell.fill = PatternFill(start_color=different_color, fill_type="solid")
|
||||
if text_color is not None:
|
||||
cell.font = Font(size=9, bold=True, color=text_color)
|
||||
else:
|
||||
@@ -107,7 +112,7 @@ def excel_description(worksheet, row1, description, size=None, color=None, my_co
|
||||
worksheet[row1] = description
|
||||
worksheet[row1].alignment = Alignment_CELL
|
||||
if size is not None:
|
||||
worksheet[row1].font = Font(size=size)
|
||||
worksheet[row1].font = Font(size=size, bold=True)
|
||||
if color is not None:
|
||||
worksheet[row1].font = red_font
|
||||
if my_color is not None:
|
||||
@@ -119,7 +124,8 @@ def excel_description(worksheet, row1, description, size=None, color=None, my_co
|
||||
|
||||
|
||||
def create_value(worksheet, list, l, num, border_style=None, m=None, height=None, color=None, width=None,
|
||||
different_cell=None, different_value=None, item_num=None, item_color=None):
|
||||
different_cell=None, different_value=None, item_num=None, item_color=None,
|
||||
m_color=None):
|
||||
color_dict = {
|
||||
'green': GREEN_CELL,
|
||||
'yellow': YELLOW_CELL,
|
||||
@@ -151,7 +157,10 @@ def create_value(worksheet, list, l, num, border_style=None, m=None, height=None
|
||||
cell.font = Font(size=10, bold=True)
|
||||
|
||||
if m is not None and m % 2 != 0:
|
||||
cell.fill = PatternFill(start_color="FAF0E7", fill_type="solid")
|
||||
if m_color:
|
||||
cell.fill = PatternFill(start_color=m_color, fill_type="solid")
|
||||
else:
|
||||
cell.fill = PatternFill(start_color="FAF0E7", fill_type="solid")
|
||||
|
||||
if height is not None:
|
||||
worksheet.row_dimensions[l + 1].height = height
|
||||
|
||||
Reference in New Issue
Block a user