I'm using Python to generate an excel document from a Pandas DataFrame.
I can set column width and text wrap with workbook.add_format({"text_wrap": True})
and worksheet.set_column(f"{cols[idx]}:{cols[idx]}", 30, format)
, but I don't know how to activate "Hyphenation active". I fail to find it in the doc : https://xlsxwriter.readthedocs.io/format.html
Here is a sample of my code :
df = get_pandas_dataframe()
writer = pd.ExcelWriter(path, engine="xlsxwriter")
sheet_name = "abc"
df.to_excel(writer, index=False, sheet_name=sheet_name)
workbook = writer.book
worksheet = writer.sheets[sheet_name]
max_row, max_col = pdf.shape
format = workbook.add_format({"text_wrap": True})
cols = dict(zip(range(26), list(string.ascii_uppercase)))
for idx, col in enumerate(df):
worksheet.set_column(f"{cols[idx]}:{cols[idx]}", 30, format)
writer.save()
Any idea?
"Hyphenation Active" isn't an Excel option and hence it isn't supported by XlsxWriter.
You can verify that yourself in Libreoffice by saving an xlsx file with that option in a cell, closing the file, and then re-opening it. The option will no longer be there.