Attempting to format output to a LibreOffice calc (ie, linux-based Excel) document but the python format syntax isn't applied as expected.
Using the new string formatting, running the below:
import openpyxl as xl
wb = xl.Workbook()
ws = wb.active
ws['A3'] = '{:>}'.format('rundate:')
ws['A4'] = '{:>}'.format('name:')
ws['A5'] = '{:>}'.format('comments:')
wb.save('test.xlsx')
Unexpectedly gives this, which appears to be left rather than right aligned:
Trying the left align char on the off chance I had them reversed:
import openpyxl as xl
wb = xl.Workbook()
ws = wb.active
ws['A3'] = '{:<}'.format('rundate:')
ws['A4'] = '{:<}'.format('name:')
ws['A5'] = '{:<}'.format('comments:')
wb.save('test.xlsx')
Returns the same:
And another version (specifying total number of chars), makes it clear the text isn't being right aligned. If anything, right aligned text should spill over the left side of the cell, not the right.
import openpyxl as xl
wb = xl.Workbook()
ws = wb.active
ws['A3'] = '{:>12}'.format('rundate:')
ws['A4'] = '{:>12}'.format('name:')
ws['A5'] = '{:>12}'.format('comments:')
wb.save('test.xlsx')


