fixed excel formatting

This commit is contained in:
2025-12-03 10:10:00 +01:00
parent 1eb11f33fc
commit e7e47152ed

View File

@@ -57,7 +57,7 @@ def export_selected(request: HttpRequest, queryset: QuerySet[WeekPreference]) ->
center = Alignment(horizontal="center", vertical="center", wrapText=True)
# Cell styles
border_thick: Side = Side(style='thick', color='000000')
border_thick: Side = Side(style='medium', color='000000')
border_thin: Side = Side(style='thin', color='000000', border_style='dashed')
border_bottom: Border = Border(bottom=border_thick)
border_bottom_thin: Border = Border(bottom=border_thin)
@@ -78,7 +78,7 @@ def export_selected(request: HttpRequest, queryset: QuerySet[WeekPreference]) ->
# Each of this iterations fills the table for a student
row: int = 2
row_offset: int = 0
for i, q in enumerate(queryset.order_by("week", "student__surname", "student__name", "student__course"), start=1):
for i, q in enumerate(queryset.order_by("-week", "student__surname", "student__name", "student__course"), start=1):
student_data: List[str]
student_phone: str = str(q.student.phone) if q.student.phone else ""
student_email: str = q.student.email
@@ -191,8 +191,7 @@ def export_selected(request: HttpRequest, queryset: QuerySet[WeekPreference]) ->
ws.cell(row=student_end, column=c).border = Border(bottom=border_thick, right=border_thin)
# And for last column also a vertical border all student high
if c == mail_index:
for row_content in range(student_start, student_end + 1):
ws.cell(row=row_content, column=c).border += border_right
ws.cell(row=student_end, column=c).border = Border(bottom=border_thick, right=border_thick)
# Merge Week, thick border
ws.cell(row=student_start, column=week_index).border = border_all