panes3.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from xlwt import Workbook
  2. from xlwt.BIFFRecords import PanesRecord
  3. w = Workbook()
  4. # do each of the 4 scenarios with each of the 4 possible
  5. # active pane settings
  6. for px,py in (
  7. (0,0), # no split
  8. (0,10), # horizontal split
  9. (10,0), # vertical split
  10. (10,10), # both split
  11. ):
  12. for active in range(4):
  13. # 0 - logical bottom-right pane
  14. # 1 - logical top-right pane
  15. # 2 - logical bottom-left pane
  16. # 3 - logical top-left pane
  17. # only set valid values:
  18. if active not in PanesRecord.valid_active_pane.get(
  19. (int(px > 0),int(py > 0))
  20. ):
  21. continue
  22. sheet = w.add_sheet('px-%i py-%i active-%i' %(
  23. px,py,active
  24. ))
  25. for rx in range(20):
  26. for cx in range(20):
  27. sheet.write(rx,cx,'R%iC%i'%(rx,cx))
  28. sheet.panes_frozen = False
  29. sheet.vert_split_pos = px * 8.43
  30. sheet.horz_split_pos = py * 12.75
  31. sheet.active_pane = active
  32. w.save('panes3.xls')