notebook
This commit is contained in:
@@ -142,6 +142,18 @@ with pd.ExcelWriter(xlsx_path, engine="openpyxl") as writer:
|
|||||||
)
|
)
|
||||||
elif isinstance(cell.value, str) and "\n" in cell.value:
|
elif isinstance(cell.value, str) and "\n" in cell.value:
|
||||||
cell.alignment = Alignment(wrap_text=True, vertical="top")
|
cell.alignment = Alignment(wrap_text=True, vertical="top")
|
||||||
|
# ----- Force wrap_text for the entire DEKURS column -----
|
||||||
|
for col in ws.columns:
|
||||||
|
header = col[0].value
|
||||||
|
if header and "DEKURS" in str(header).upper():
|
||||||
|
for cell in col[1:]: # skip header row
|
||||||
|
# preserve existing alignment if possible
|
||||||
|
align = cell.alignment
|
||||||
|
cell.alignment = Alignment(
|
||||||
|
horizontal=align.horizontal or "left",
|
||||||
|
vertical="top",
|
||||||
|
wrap_text=True
|
||||||
|
)
|
||||||
|
|
||||||
# ----- Column widths -----
|
# ----- Column widths -----
|
||||||
for col in ws.columns:
|
for col in ws.columns:
|
||||||
|
|||||||
Reference in New Issue
Block a user