Free Support Forum - aspose.com

To divide the table to pages

Hi,

I have a table in the word document. When product name in table change, I want to write the remaining rows to next page.

How can I do that? I waiting for your help..

Thanks..

Hi,


Thanks for your request.

Could you attach a sample document? I will try to provide you with a sample code.

Best regards,

Hi,

Here is the code ..

Thanks for your help..

Hi,

Please see the sample below. You need to set PageBreakBefore to true for the paragraph of the cell where you need to insert page break;

// build simple table.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

// first row

builder.InsertCell();

builder.Write("This cells are on the first page");

builder.InsertCell();

builder.Write("This cells are on the first page");

builder.EndRow();

// second row.

builder.InsertCell();

builder.Write("This cells are on the first page");

builder.InsertCell();

builder.Write("This cells are on the first page");

builder.EndRow();

// Third row will be on the next page.

// third row

builder.InsertCell();

builder.ParagraphFormat.PageBreakBefore = true;

builder.Write("This cells are on the second page");

builder.InsertCell();

builder.ParagraphFormat.PageBreakBefore = false;

builder.Write("This cells are on the second page");

builder.EndRow();

// fourth row.

builder.InsertCell();

builder.Write("This cells are on the second page");

builder.InsertCell();

builder.Write("This cells are on the second page");

builder.EndRow();

builder.EndTable();

doc.SaveToPdf(@"out.pdf");

Regards,

Hi,

Thank you very much.. Its working.. Its all right..