[]
A vertical page break defines where printed content is split into the next page across columns. You can obtain an IVPageBreak from IWorksheet.getVPageBreaks(), inspect its location with getLocation(), determine whether it spans the full sheet or only the print area with getExtent(), or remove it with delete().
worksheet.getRange("A1:F10").setValue("Data");
IVPageBreaks pageBreaks = worksheet.getVPageBreaks();
pageBreaks.add(worksheet.getRange("D1"));
IVPageBreak pageBreak = pageBreaks.get(0);
IRange location = pageBreak.getLocation();
PageBreakExtent extent = pageBreak.getExtent();
voiddelete()Use this method to remove a page break that was previously added to the worksheet's IWorksheet.getVPageBreaks() collection.
worksheet.getRange("A1:G5").setValue(new Object[][] {
{"Name", "Q1", "Q2", "Q3", "Q4", "Total", "Region"},
{"Alice", 10, 12, 11, 9, 42, "East"}
});
IVPageBreak pageBreak = worksheet.getVPageBreaks().add(worksheet.getRange("F3"));
pageBreak.delete();
This method returns a PageBreakExtent value that indicates whether the vertical page break applies to the full sheet or only within the print area.
IVPageBreak pageBreak = worksheet.getVPageBreaks().add(worksheet.getRange("F3"));
PageBreakExtent extent = pageBreak.getExtent();
String scope = extent == PageBreakExtent.PageBreakPartial ? "Print area" : "Full sheet";
PageBreakExtent that specifies whether the page break applies to the entire worksheet or only within the print area.Horizontal page breaks are aligned with the top edge of the location range; vertical page breaks are aligned with the left edge of the location range.
worksheet.getRange("A1:F5").setValue(new Object[][] {
{"Name", "Q1", "Q2", "Q3", "Q4", "Total"},
{"Test", 100, 200, 150, 180, 630}
});
IVPageBreak pageBreak = worksheet.getVPageBreaks().add(worksheet.getRange("F3"));
IRange location = pageBreak.getLocation();
IRange that defines the page-break location.