Managing Page Breaks

Page Breaks

Aspose.Cells provides a class Workbook that represents an Excel file. The Workbook class contains a Worksheets collection that allows access to each worksheet in the Excel file.

A worksheet is represented by the Worksheet class. The Worksheet class provides a wide range of methods used to manage a worksheet. To add the page breaks, use the AddPageBreaks method of the Worksheet class.

Adding Page Breaks

//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
//Output directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
//Path of output excel file
U16String outputPageBreaks = outDir + u"outputManagingPageBreaks.xlsx";
//Instantiating a Workbook object
Workbook workbook;
//Add a page break at cell J20
workbook.GetWorksheets().Get(0).AddPageBreaks(u"J20");
//Save the Excel file.
workbook.Save(outputPageBreaks);