This commit is contained in:
2025-11-04 17:49:13 +01:00
parent 6237616e11
commit 991be3f3e4
2 changed files with 318 additions and 4 deletions

View File

@@ -178,12 +178,27 @@ df.to_excel(xlsx_path, index=False)
wb = load_workbook(xlsx_path)
ws = wb.active
# style header
for col in range(1, len(df.columns) + 1):
c = ws.cell(row=1, column=col)
# === Apply styling and custom column widths ===
widths = {
1: 11, # A - Date
2: 13, # B - Time
3: 45, # C - Title
4: 30, # D - Patient
5: 15, # E - DOB
6: 15, # F - Insurance
7: 30, # G - Note
8: 15, # H - Color
9: 37, # I - Request_ID
10: 37 # J - Reservation_ID
}
for col_idx in range(1, len(df.columns) + 1):
col_letter = get_column_letter(col_idx)
c = ws.cell(row=1, column=col_idx)
c.font = Font(bold=True)
c.alignment = Alignment(horizontal="center")
ws.column_dimensions[get_column_letter(col)].width = 20
ws.column_dimensions[col_letter].width = widths.get(col_idx, 20)
ws.freeze_panes = "A2"
wb.save(xlsx_path)