Skip to content

Instantly share code, notes, and snippets.

@sjaensch
Created May 27, 2014 10:39
Show Gist options
  • Save sjaensch/106e2e1c63adc2379b10 to your computer and use it in GitHub Desktop.
Save sjaensch/106e2e1c63adc2379b10 to your computer and use it in GitHub Desktop.
xlwt row height example
#!/usr/bin/env python
import xlwt
def wraptest():
wb = xlwt.Workbook()
sty = xlwt.XFStyle()
al = xlwt.Alignment()
al.wrap = xlwt.Alignment.WRAP_AT_RIGHT
sty.alignment = al
ws = wb.add_sheet('x')
strg = "very very very very very very very long string to test the auto resizing feature"
ws.write(0, 0, strg, sty) # row's height is adjusted correctly
ws.write(1, 0, strg, sty) # row's height is not adjusted!
wb.save('wraptest.xls')
if __name__ == "__main__":
wraptest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment