You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I insert text that wraps around multiple lines and set the alignment in options to center it instead aligns to the left
I'm using Python 3.7 and XlsxWriter 1.2.7 and Excel 2019. The issue appears on google sheets too.
Here is some code that demonstrates the problem:
importxlsxwriterwb=xlsxwriter.Workbook('test.xlsx')
ws=wb.add_worksheet()
text='This is a very long text that should wrap around multiple line and still be in the center'options= {
'align': {'vertical': 'middle',
'horizontal': 'center'},
}
ws.insert_textbox(0,0, text, options)
wb.close()
The text was updated successfully, but these errors were encountered:
Also, the text is centered, in a way. For example if you make the textbox much wider you can see that the text is in the center:
importxlsxwriterwb=xlsxwriter.Workbook('test.xlsx')
ws=wb.add_worksheet()
text='This is a very long text that should wrap around multiple line and still be in the center'options= {
'width': 640,
'align': {'vertical': 'middle',
'horizontal': 'center'},
}
ws.insert_textbox(0, 0, text, options)
wb.close()
Nevertheless, I can see that it isn't rendered as you would expect. There is another center that needs to be applied to the text itself.
Added text alignment for textboxes. The existing options allowed
the text area to be aligned but didn't offer control over the
text within that area.
Issue #684
Fixed on main. You can now specify a additional text alignment property to get the alignment you are looking for.
Like this:
importxlsxwriterwb=xlsxwriter.Workbook('test.xlsx')
ws=wb.add_worksheet()
text='This is a long text line that should wrap around multiple lines and still be in the center'options= {
'align': {'vertical': 'middle',
'horizontal': 'center',
'text': 'center'},
}
ws.insert_textbox(0, 0, text, options)
wb.close()
Hi,
When I insert text that wraps around multiple lines and set the alignment in options to center it instead aligns to the left
I'm using Python 3.7 and XlsxWriter 1.2.7 and Excel 2019. The issue appears on google sheets too.
Here is some code that demonstrates the problem:
The text was updated successfully, but these errors were encountered: