update write file
This commit is contained in:
parent
96e135a13f
commit
73c02d6cdb
Binary file not shown.
@ -22,7 +22,7 @@ from ..celery_worker.client_connector import c_connector
|
|||||||
import imagesize
|
import imagesize
|
||||||
import csv
|
import csv
|
||||||
from openpyxl import load_workbook
|
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(
|
s3_client = S3Util.MinioS3Client(
|
||||||
endpoint=settings.S3_ENDPOINT,
|
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_green = PatternFill(start_color=green, end_color=green, fill_type = "solid")
|
||||||
fill_yellow = PatternFill(start_color=yellow, end_color=yellow, 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")
|
fill_gray = PatternFill(start_color=gray, end_color=gray, fill_type = "solid")
|
||||||
|
align_right = Alignment(horizontal='right')
|
||||||
if _type == 'report':
|
if _type == 'report':
|
||||||
wb = load_workbook(filename = 'report.xlsx')
|
wb = load_workbook(filename = 'report.xlsx')
|
||||||
ws = wb['Sheet1']
|
ws = wb['Sheet1']
|
||||||
@ -573,7 +573,8 @@ def dict2xlsx(input: json, _type='report'):
|
|||||||
ws[key + str(start_index)] = value
|
ws[key + str(start_index)] = value
|
||||||
ws[key + str(start_index)].border = border
|
ws[key + str(start_index)].border = border
|
||||||
ws[key + str(start_index)].font = font_black
|
ws[key + str(start_index)].font = font_black
|
||||||
|
if key in ['G', 'H']:
|
||||||
|
ws[key + str(start_index)].alignment = align_right
|
||||||
start_index += 1
|
start_index += 1
|
||||||
|
|
||||||
return wb
|
return wb
|
||||||
|
Loading…
Reference in New Issue
Block a user