update write file

This commit is contained in:
PhanThanhTrung 2024-03-06 16:32:50 +07:00
parent 96e135a13f
commit 73c02d6cdb
2 changed files with 4 additions and 3 deletions

Binary file not shown.

View File

@ -22,7 +22,7 @@ from ..celery_worker.client_connector import c_connector
import imagesize
import csv
from openpyxl import load_workbook
from openpyxl.styles import Font, Border, Side, PatternFill, NamedStyle, numbers
from openpyxl.styles import Font, Border, Side, PatternFill, NamedStyle, numbers, Alignment
s3_client = S3Util.MinioS3Client(
endpoint=settings.S3_ENDPOINT,
@ -467,7 +467,7 @@ def dict2xlsx(input: json, _type='report'):
fill_green = PatternFill(start_color=green, end_color=green, fill_type = "solid")
fill_yellow = PatternFill(start_color=yellow, end_color=yellow, fill_type = "solid")
fill_gray = PatternFill(start_color=gray, end_color=gray, fill_type = "solid")
align_right = Alignment(horizontal='right')
if _type == 'report':
wb = load_workbook(filename = 'report.xlsx')
ws = wb['Sheet1']
@ -573,7 +573,8 @@ def dict2xlsx(input: json, _type='report'):
ws[key + str(start_index)] = value
ws[key + str(start_index)].border = border
ws[key + str(start_index)].font = font_black
if key in ['G', 'H']:
ws[key + str(start_index)].alignment = align_right
start_index += 1
return wb