add height to all excel

This commit is contained in:
7nimor
2025-08-02 08:21:04 +03:30
parent ae7bdd76ef
commit f59542252b
3 changed files with 22 additions and 31 deletions

View File

@@ -43,13 +43,13 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
product = product.filter(
Q(assigned_organization=organization)
).order_by('-modify_date')
description_name = 'سهمیه' # noqa
description_name = 'سهمیه' # noqa
elif query.get('param') == 'assigner':
product = product.filter(
Q(assigner_organization=organization)
).order_by('-modify_date')
description_name = 'توزیع' # noqa
description_name = 'توزیع' # noqa
elif query.get('param') == 'all':
product = product.filter(
@@ -86,11 +86,11 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
]
create_header(worksheet, header_list, 5, 2, height=20, border_style='thin')
create_header(worksheet, header_list, 5, 2, height=25, border_style='thin')
excel_description(worksheet, 'B1', f'{description_name}', row2='C3')
create_header_freez(worksheet, excel_options, 1, 6, 7, height=22, width=20)
create_header_freez(worksheet, excel_options, 1, 6, 7, height=25, width=20)
l = 6
m = 1
@@ -114,7 +114,7 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
data.get('warehouse_entry') or 0,
data.get('description') or '-'
]
create_value(worksheet, list1, l + 1, 1, m=m)
create_value(worksheet, list1, l + 1, 1, height=24, m=m)
m += 1
l += 1
@@ -152,15 +152,15 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
'',
]
create_value(worksheet, list2, l + 3, 1, color='gray') # noqa
create_value(worksheet, list2, l + 3, 1, color='gray') # noqa
workbook.save(output)
output.seek(0)
response = HttpResponse(
content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') # noqa
content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') # noqa
response[
'Content-Disposition'] = f'attachment; filename="سهمیه.xlsx"'.encode( # noqa
'Content-Disposition'] = f'attachment; filename="سهمیه.xlsx"'.encode( # noqa
'utf-8')
response.write(output.getvalue())
return response
@@ -203,7 +203,7 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
excel_description(worksheet, 'B1', f'طرح های تشویقی', row2='C3')
create_header_freez(worksheet, excel_options, 1, 6, 7, height=22, width=20)
create_header_freez(worksheet, excel_options, 1, 6, 7, height=25, width=20)
l = 6
m = 1
@@ -225,7 +225,7 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
str(shamsi_date(convert_str_to_date(data.get('start_date_limit')), in_value=True)),
str(shamsi_date(convert_str_to_date(data.get('end_date_limit')), in_value=True)),
]
create_value(worksheet, list1, l + 1, 1, m=m)
create_value(worksheet, list1, l + 1, 1, height=24, m=m)
m += 1
l += 1
@@ -241,7 +241,7 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
'',
]
create_value(worksheet, list2, l + 3, 1, color='gray') # noqa
create_value(worksheet, list2, l + 3, 1, height=24, color='gray') # noqa
workbook.save(output)
output.seek(0)
@@ -249,7 +249,7 @@ class ProductExcelViewSet(viewsets.ModelViewSet):
response = HttpResponse(
content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
response[
'Content-Disposition'] = f'attachment; filename="طرح های تشویقی.xlsx"'.encode( # noqa
'Content-Disposition'] = f'attachment; filename="طرح های تشویقی.xlsx"'.encode( # noqa
'utf-8')
response.write(output.getvalue())
return response