Insert Page Break

Is there an example of how to insert a page break into an excel document?

Thanks

Chad

1 Reply

MW Melba Winshia Syncfusion Team February 19, 2007 05:57 AM UTC

Hi Chad,

Thanks for your interest in Essential XlsIO.

To insert a page break in a worksheet, please insert vertical and horizontal page breaks at the specified cell by calling the Add method. Please refer the following code snippet which illustrates the above:

[C#]

//Entering text into the cells
sheet.Range[ "A1:M20" ].Text = "PageBreak";

// Giving Horizontal pagebreaks
sheet.HPageBreaks.Add( sheet.Range[ "A5" ] );
sheet.HPageBreaks.Add( sheet.Range[ "A10" ] );
sheet.HPageBreaks.Add( sheet.Range[ "A15" ] );

// Giving Vertical pagebreaks
sheet.VPageBreaks.Add( sheet.Range[ "B5" ] );
sheet.VPageBreaks.Add( sheet.Range[ "E10" ] );
sheet.VPageBreaks.Add( sheet.Range[ "K15" ] );

Here is the sample for your reference:

PageBreak.zip

Kindly take a look at the sample above and let me know if you have any other questions.

Regards,
Melba

Loader.
Up arrow icon