public final class PageSettingsBlock extends RecordAggregate
See OOO excelfileformat.pdf sec 4.4 'Page Settings Block'
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.
|
void |
addLateRecords(RecordStream rs)
This method reads PageSettingsBlock records from the supplied RecordStream until the first
non-PageSettingsBlock record is encountered.
|
int[] |
getColumnBreaks() |
FooterRecord |
getFooter()
Returns the FooterRecord.
|
HCenterRecord |
getHCenter() |
HeaderRecord |
getHeader()
Returns the 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.
|
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.
|
void |
setMargin(short margin,
double size)
Sets the size of the margin in inches.
|
void |
setPrintSetup(PrintSetupRecord newPrintSetup)
Sets the 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. |
getRecordSize, serialize
public PageSettingsBlock(RecordStream rs)
public PageSettingsBlock()
public static boolean isComponentRecord(int sid)
sid
- the record sidtrue
if the specified Record sid is one belonging to the
'Page Settings Block'.public void setColumnBreak(short column, short fromRow, short toRow)
column
- the column to add page breaks tofromRow
- the starting rowtoRow
- the ending rowpublic void removeColumnBreak(int column)
column
- the column to check for page breakspublic 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 cloningvisitContainedRecords
in class RecordAggregate
rv
- The visitor to use for callbacks while walking this objectpublic HeaderRecord getHeader()
public void setHeader(HeaderRecord newHeader)
newHeader
- The new HeaderRecord for the sheet.public FooterRecord getFooter()
public void setFooter(FooterRecord newFooter)
newFooter
- The new FooterRecord for the sheet.public PrintSetupRecord getPrintSetup()
public void setPrintSetup(PrintSetupRecord newPrintSetup)
newPrintSetup
- The new PrintSetupRecord for the sheet.public double getMargin(short margin)
margin
- which margin to getpublic void setMargin(short margin, double size)
margin
- which margin to getsize
- the size of the marginpublic void setRowBreak(int row, short fromCol, short toCol)
row
- the rowfromCol
- the starting columntoCol
- the ending columnpublic void removeRowBreak(int row)
row
- the rowpublic boolean isRowBroken(int row)
row
- the row to check forpublic boolean isColumnBroken(int column)
column
- the column to check fortrue
if the specified column has a page breakpublic void shiftRowBreaks(int startingRow, int endingRow, int count)
startingRow
- the starting rowendingRow
- the ending rowcount
- the number of rows to shift bypublic void shiftColumnBreaks(short startingCol, short endingCol, short count)
startingCol
- the starting columnendingCol
- the ending columncount
- the number of columns to shift bypublic 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.rec
- the HeaderFooterRecord to setpublic 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.
rs
- the RecordStream to read fromRecordFormatException
- if any PSB record encountered has the same type (sid) as
a record that is already part of this PageSettingsBlockpublic void positionRecords(java.util.List<RecordBase> sheetRecords)
sheetRecords
- the list of sheet records read so farCopyright 2020 The Apache Software Foundation or its licensors, as applicable.