Page break in word by liqn

test.docx (14.0 KB)

Hi Team, I am performing some operation on template by linq(attached file). After each loop, I need to move to next page. I have done as per attached word. But at the last loop, it is creating one blank page. How can we avoid it? To avoid giving page break at the last?

@manojdesai272 In your case, you can use Page break before option of paragraph to achieve this:

Please see the attached sample template and output produced by the following code:

List<string> dummyData = new List<string>() { "first", "second", "third" };

Document doc = new Document(@"C:\Temp\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, dummyData, "data");
doc.Save(@"C:\Temp\out.docx");

in.docx (12.4 KB)
out.docx (9.8 KB)