4

XlsxWriter has a method of adding frozen panes to an excel file:

import xlsxwriter

workbook = xlsxwriter.Workbook('frozen_panes.xlsx')
worksheet1 = workbook.add_worksheet('Panes 1')
worksheet1.freeze_panes(1, 0)

However, I have to use Pyexcelerate, and I can't find anything in their docs related to froze panes. Does Pyexcelerate have a similar method which would allow me to add frozen panes?

jonesne
  • 191
  • 10
  • http://fossies.org/dox/picalo-4.94/classpicalo_1_1lib_1_1pyExcelerator_1_1BIFFRecords_1_1Window2Record.html This class has options regarding freeze_panes – Jan Mar 02 '16 at 17:31
  • @JeD It's PyExcelerate I'm using, not PyExcelerator – jonesne Mar 02 '16 at 17:37
  • Oh sorry. There is a freeze option in the panes class: https://github.com/kz26/PyExcelerate/blob/dev/pyexcelerate/Panes.py but I'm not sure how to use it. I'll tell you if I find s.th. – Jan Mar 02 '16 at 17:49
  • I believe you have to get the worksheet and then simply add a pane with freeze = true.. Try it ;) – Jan Mar 02 '16 at 17:57
  • @JeD Thats it! Thanks very much :) – jonesne Mar 02 '16 at 18:20

2 Answers2

4

To whom it may concern:

The solution was to get a worksheet and add a Pane with the option freeze = true.

The class Pane can be seen here:

https://github.com/kz26/PyExcelerate/blob/dev/pyexcelerate/Panes.py

Jan
  • 1,504
  • 10
  • 15
2
import pyexcelerate
wb = pyexcelerate.Workbook()
ws = wb.new_sheet("sheet name")
# suppose you want to freeze rows 1-2 and columns A-D
rows = 2
columns = 4
ws.panes = pyexcelerate.Panes(columns, rows) # note order versus set_cell_value
wb.save("example_freeze_panes.xlsx")