[英]xlwt - How to add page breaks to an Excel File?
做一些网络研究我发现这个OpenOffice.org文档描述了Excel的格式和BIFF记录。 似乎是横向休息(第181页),每个元组代表:
因此,对于您在问题中显示的示例,您有两个分页符,一个在行54上,另一个在行108上,它们都从第0列跨越到第255列。
同样适用于垂直休息; 只需在前面的描述中交换“row”和“column”。
挖掘xlwt的源代码,结果是{vert,horiz}_page_breaks
是属性(参见源代码分发中的Worksheet.py
),最终传递给BIFFRecords.{Vertical,Horizontal}PageBreaksRecord
(参见BIFFRecords.py
)。 最后两个类是记录在案的。 这是他们的文档,以防您发现它们有用:
class HorizontalPageBreaksRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains all
horizontal manual page breaks.
Record HORIZONTALPAGEBREAKS, BIFF8:
Offset Size Contents
0 2 Number of following row index structures (nm)
2 6nm List of nm row index structures. Each row index
structure contains:
Offset Size Contents
0 2 Index to first row below the page break
2 2 Index to first column of this page break
4 2 Index to last column of this page break
The row indexes in the lists must be ordered ascending.
If in BIFF8 a row contains several page breaks, they must be ordered
ascending by start column index.
"""
class VerticalPageBreaksRecord(BiffRecord):
"""
This record is part of the Page Settings Block. It contains all
vertical manual page breaks.
Record VERTICALPAGEBREAKS, BIFF8:
Offset Size Contents
0 2 Number of following column index structures (nm)
2 6nm List of nm column index structures. Each column index
structure contains:
Offset Size Contents
0 2 Index to first column following the page
break
2 2 Index to first row of this page break
4 2 Index to last row of this page break
The column indexes in the lists must be ordered ascending.
If in BIFF8 a column contains several page breaks, they must be ordered
ascending by start row index.
"""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.