We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

LINQ: forEach Table spacing problem

Hello,
I’m creating the tables with LINQ Reporting Engine, but i want to add some space between them. One trick would be to add an empty row with no borders, but I also want to repeat the table.

testWord.zip (19.2 KB)

One solution I found is to put an if, based on the number of lines, I print a new line. This way I don’t have the case where the new line is at the beginning of the paragraph. Other solutions?

image.png (3.6 KB)

@Blegork

Could you please share your expected Word document here for our reference? We will then provide you more information on it.

@tahir.manzoor
I expect to have a new line between table, and to have the repeat header row. In the way I wrote I can have a new line at the top of the page, I would like to avoid this.

DOC.docx (22.1 KB)
DOC_NEW.docx (24.7 KB)

@Blegork

In your code, you are using following line of code to remove empty paragraphs. This code is related to mail merge.

doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS);

Please use the following modified code and attached modified document to get the desired output. Hope this helps you. DOC_modified.docx (22.0 KB)

Document document = new Document(MyDir + "DOC_modified.docx");

ReportingEngine engine = new ReportingEngine();
engine.getKnownTypes().add(Manager.class);
engine.getKnownTypes().add(Contract.class);
engine.getKnownTypes().add(ControlChar.class);
engine.setOptions(ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS);

engine.buildReport(document, Common.GetManagers(), "managers");
document.save(MyDir + "output.docx");
1 Like