LINQ Reporting: New Line after inserting document dynamically

Hi Team,

I am trying to insert a document dynamically using the <<doc [doc1] -build>> tag. However, When I try to do this inline, it adds a newline after the end of the inserted document. I want to keep the -build flag so that I can pass the data along to the inner document for rendering. How can I get it so that the inner document comes in without the newline?

EX:
the <<doc [doc1] -build>> days
results in:
the innerData
days

Thanks,
Cody

@cmitch79 You should also specify -inline switch to get the expected output, like this
<<doc [src] -inline -build>>
for example see the following code:

Document src = new Document();
src.FirstSection.Body.FirstParagraph.AppendChild(new Run(src, "This is source document"));

Document template = new Document();
template.FirstSection.Body.FirstParagraph.AppendChild(new Run(template, "text before \"<<doc [src] -inline -build>>\" text after"));

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(template, src, "src");

template.Save(@"C:\Temp\out.docx");

Please see our documentation for more information:
https://docs.aspose.com/words/net/inserting-documents-dynamically/

1 Like

Whenever I include the -inline flag, I get an error:
" Tag 'doc' is not well-formed. Token 'inline' is unexpected."

Is there something that I need to include or update in order to be able to use that flag?

@cmitch79 It looks like you are using old version of Aspose.Words. -inline switch has been introduced in 22.11 version of Aspose.Words:
https://docs.aspose.com/words/net/aspose-words-for-net-22-11-release-notes/#added-a-switch-to-trim-the-last-paragraph-break-when-inserting-a-document-using-linq-reporting-engine

1 Like