Text wraping not working in Excel Online

Issue #962 invalid
Aleksey Maksimov
created an issue

It seems strange, that text wrapping works only on desktop version of Excel. First, I found that wrapping doesn`t work in my LibreOffice, so I am interested in LibreOffice support mostly. But it seems to be a true bug, if it does not work even in Excel Online (loaden via OneDrive).

The fix must exist, because when I open 'cell properties', I see all formatting flags set: I just press OK (the wrapping is applied now) and save the document, load the file to the OneDrive and open with Excel Online to see styles applied.

The extracted files from .zip, created by openpyxl, are different from created in LibreOffice and Excel Online.

The text wrapping, created in Excel Online also works in LibreOffice, so in this case LibreOffice <=> Excel Online.

wb = Workbook()
ws = wb.worksheets[0]
ws.title = "Sheet1"

ws['A1'].alignment = Alignment(wrap_text=True)
ws['A1'].value = "Some long \ntext to wrap\n in a cell"
wb.save('wrap_text1.xlsx')

Openpyxl 2.5.0, python 3.6.4, Arch Linux

5a686a383ea0b640841958.png

Comments (8)

  1. CharlieC

    Text-wrapping is actually something the application does. All we can do is set the relevant flags and the code does this in accordance with the specification. You might want to explicitly set the column width.

  2. Log in to comment