public final class PageSettingsBlock extends RecordAggregate
See OOO excelfileformat.pdf sec 4.4 'Page Settings Block'
(对工作表的页面设置记录进行分组。请参阅 OOO excelfileformat.pdf sec 4.4 '页面设置块')RecordAggregate.PositionTrackingVisitor, RecordAggregate.RecordVisitor
Constructor and Description |
---|
PageSettingsBlock()
Creates a PageSettingsBlock with default settings
|
PageSettingsBlock(RecordStream rs) |
Modifier and Type | Method and Description |
---|---|
void |
addLateHeaderFooter(HeaderFooterRecord rec)
HEADERFOOTER is new in 2007.
(HEADERFOOTER 是 2007 年的新产品。)
|
void |
addLateRecords(RecordStream rs)
This method reads PageSettingsBlock records from the supplied RecordStream until the first non-PageSettingsBlock record is encountered.
(此方法从提供的 RecordStream 中读取 PageSettingsBlock 记录,直到遇到第一个非 PageSettingsBlock 记录。)
|
int[] |
getColumnBreaks() |
FooterRecord |
getFooter()
Returns the FooterRecord.
(返回页脚记录。)
|
HCenterRecord |
getHCenter() |
HeaderRecord |
getHeader()
Returns the HeaderRecord.
(返回 HeaderRecord。)
|
double |
getMargin(short margin)
Gets the size of the margin in inches.
(以英寸为单位获取边距的大小。)
|
int |
getNumColumnBreaks() |
int |
getNumRowBreaks() |
PrintSetupRecord |
getPrintSetup()
Returns the PrintSetupRecord.
(返回打印设置记录。)
|
int[] |
getRowBreaks() |
VCenterRecord |
getVCenter() |
boolean |
isColumnBroken(int column)
Queries if the specified column has a page break
(查询指定列是否有分页符)
|
static boolean |
isComponentRecord(int sid) |
boolean |
isRowBroken(int row)
Queries if the specified row has a page break
(查询指定行是否有分页符)
|
void |
positionRecords(java.util.List<RecordBase> sheetRecords)
Some apps can define multiple HeaderFooterRecord records for a sheet.
(一些应用程序可以为工作表定义多个 HeaderFooterRecord 记录。)
|
void |
removeColumnBreak(int column)
Removes a page break at the indicated column
(删除指定列的分页符)
|
void |
removeRowBreak(int row)
Removes a page break at the indicated row
(删除指定行的分页符)
|
void |
setColumnBreak(short column, short fromRow, short toRow)
Sets a page break at the indicated column
(在指示的列处设置分页符)
|
void |
setFooter(FooterRecord newFooter)
Sets the FooterRecord.
(设置页脚记录。)
|
void |
setHeader(HeaderRecord newHeader)
Sets the HeaderRecord.
(设置 HeaderRecord。)
|
void |
setMargin(short margin, double size)
Sets the size of the margin in inches.
(以英寸为单位设置边距的大小。)
|
void |
setPrintSetup(PrintSetupRecord newPrintSetup)
Sets the PrintSetupRecord.
(设置 PrintSetupRecord。)
|
void |
setRowBreak(int row, short fromCol, short toCol)
Sets a page break at the indicated row
(在指定行设置分页符)
|
void |
shiftColumnBreaks(short startingCol, short endingCol, short count)
Shifts the vertical page breaks for the indicated count
(移动指定计数的垂直分页符)
|
void |
shiftRowBreaks(int startingRow, int endingRow, int count)
Shifts the horizontal page breaks for the indicated count
(移动指定计数的水平分页符)
|
void |
visitContainedRecords(RecordAggregate.RecordVisitor rv)
Visit each of the atomic BIFF records contained in this
RecordAggregate in the order that they should be written to file.
(按照写入文件的顺序访问此 RecordAggregate 中包含的每个原子 BIFF 记录。)
|
getRecordSize, serialize
public PageSettingsBlock(RecordStream rs)
public PageSettingsBlock()
public static boolean isComponentRecord(int sid)
sid
- the record sid
(sid - 记录 sid)
true
if the specified Record sid is one belonging to the 'Page Settings Block'.
(如果指定的记录 sid 属于“页面设置块”,则为 true。)
public void setColumnBreak(short column, short fromRow, short toRow)
column
- the column to add page breaks to
(column - 要添加分页符的列)
fromRow
- the starting row
(fromRow - 起始行)
toRow
- the ending row
(toRow - 结束行)
public void removeColumnBreak(int column)
column
- the column to check for page breaks
(column - 检查分页符的列)
public void visitContainedRecords(RecordAggregate.RecordVisitor rv)
RecordAggregate
RecordAggregate
in the order that they should be written to file. Implementors may or may not return the actual
Record
s being used to manage POI's internal implementation. Callers should not assume either way, and therefore only attempt to modify those
Record
s after cloning
(按照写入文件的顺序访问此 RecordAggregate 中包含的每个原子 BIFF 记录。实施者可能会或可能不会返回用于管理 POI 内部实施的实际记录。调用者不应采取任何一种方式,因此仅在克隆后尝试修改这些记录)
visitContainedRecords
in class
RecordAggregate
(类 RecordAggregate 中的 visitContainedRecords)
rv
- The visitor to use for callbacks while walking this object
(rv - 访问此对象时用于回调的访问者)
public HeaderRecord getHeader()
public void setHeader(HeaderRecord newHeader)
newHeader
- The new HeaderRecord for the sheet.
(newHeader - 工作表的新 HeaderRecord。)
public FooterRecord getFooter()
public void setFooter(FooterRecord newFooter)
newFooter
- The new FooterRecord for the sheet.
(newFooter - 工作表的新 FooterRecord。)
public PrintSetupRecord getPrintSetup()
public void setPrintSetup(PrintSetupRecord newPrintSetup)
newPrintSetup
- The new PrintSetupRecord for the sheet.
(newPrintSetup - 工作表的新 PrintSetupRecord。)
public double getMargin(short margin)
margin
- which margin to get
(保证金 - 要获得的保证金)
public void setMargin(short margin, double size)
margin
- which margin to get
(保证金 - 要获得的保证金)
size
- the size of the margin
(size - 边距的大小)
public void setRowBreak(int row, short fromCol, short toCol)
row
- the row
(行 - 行)
fromCol
- the starting column
(fromCol - 起始列)
toCol
- the ending column
(toCol - 结束列)
public void removeRowBreak(int row)
row
- the row
(行 - 行)
public boolean isRowBroken(int row)
row
- the row to check for
(row - 要检查的行)
public boolean isColumnBroken(int column)
column
- the column to check for
(column - 要检查的列)
true
if the specified column has a page break
(如果指定的列有分页符,则为 true)
public void shiftRowBreaks(int startingRow, int endingRow, int count)
startingRow
- the starting row
(startRow - 起始行)
endingRow
- the ending row
(endingRow - 结束行)
count
- the number of rows to shift by
(count - 要移动的行数)
public void shiftColumnBreaks(short startingCol, short endingCol, short count)
startingCol
- the starting column
(startCol - 起始列)
endingCol
- the ending column
(endingCol - 结束列)
count
- the number of columns to shift by
(count - 要移动的列数)
public int[] getRowBreaks()
null
(所有水平分页符,从不为空)
public int getNumRowBreaks()
public int[] getColumnBreaks()
null
(所有列分页符,从不为空)
public int getNumColumnBreaks()
public VCenterRecord getVCenter()
public HCenterRecord getHCenter()
public void addLateHeaderFooter(HeaderFooterRecord rec)
PageSettingsBlock
where it belongs.
(HEADERFOOTER 是 2007 年的新品。有些应用程序似乎在它所属的 PageSettingsBlock 之后很久就分散了这个记录。)
rec
- the HeaderFooterRecord to set
(rec - 要设置的 HeaderFooterRecord)
public void addLateRecords(RecordStream rs)
The latest Excel version seems to write the PageSettingsBlock uninterrupted. However there are several examples (that Excel reads OK) where these records are not written together:
Note - when POI writes out this PageSettingsBlock, the records will always be written in one consolidated block (in the standard ordering) regardless of how scattered the records were when they were originally read.
(此方法从提供的 RecordStream 中读取 PageSettingsBlock 记录,直到遇到第一个非 PageSettingsBlock 记录。读取每条记录时,都会将其合并到此 PageSettingsBlock 中。最新的 Excel 版本似乎可以不间断地编写 PageSettingsBlock。但是,有几个示例(Excel 读取正常)这些记录没有一起写入: WINDOW2 之后的 HEADER_FOOTER(0x089C) - 此记录是 2007 年的新记录。某些应用程序似乎在它所属的 PageSettingsBlock 测试样本之后很久就分散了此记录:SharedFormulaTest.xls、ex44921-21902.xls、ex42570-20305.xls PLS、WSBOOL、PageSettingsBlock - WSBOOL 不是 PSB 记录。这发生在测试样本文件“NoGutsRecords.xls”和“WORKBOOK_in_capitals.xls”尺寸之后的边距 - 所有 PSB 都应该在尺寸之前。 (错误 47199)这些可能是由其他应用程序(或早期版本的 Excel)编写的。决定不编写用于检测每种情况的特定代码。 POI 现在允许以任何顺序散布在工作表记录流中的 PageSettingsBlock 记录,但不允许任何这些记录的重复。注意 - 当 POI 写出此 PageSettingsBlock 时,记录将始终写入一个合并块中(按标准顺序),无论最初读取记录时记录的分散程度如何。)rs
- the RecordStream to read from
(rs - 要读取的 RecordStream)
RecordFormatException
- if any PSB record encountered has the same type (sid) as a record that is already part of this PageSettingsBlock
(RecordFormatException - 如果遇到的任何 PSB 记录与已经是此 PageSettingsBlock 一部分的记录具有相同的类型 (sid))
public void positionRecords(java.util.List<RecordBase> sheetRecords)
sheetRecords
- the list of sheet records read so far
(sheetRecords - 到目前为止读取的工作表记录列表)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.