Managing Page Breaks

Page Breaks

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

A worksheet is represented by the IWorksheet class. The IWorksheet class provides a wide range of methods used to manage a worksheet. To add the page breaks, use the AddPageBreaks method of the IWorksheet 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
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\");
//Path of output excel file
StringPtr outputPageBreaks = outDir->StringAppend(new String("outputManagingPageBreaks.xlsx"));
//Instantiating a Workbook object
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook();
//Add a page break at cell J20
workbook->GetIWorksheets()->GetObjectByIndex(0)->AddPageBreaks(new String("J20"));
//Save the Excel file.
workbook->Save(outputPageBreaks);