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