Support of section break inside foreach tag in LINQ Reporting using .NET

Is it possible to have different headers using LINQ (Reporting class)?:

I want to generate a document with invoices data and write the customer’s name in the header. So, each invoice must have a different header. There are invoice of a single page and others with multiple pages.

Thank you.

@VictorMDiego

Could you please ZIP and attach your input and expected output Word document here for our reference? We will then provide you more information about your query.

I attach the ZIP with two JSON files with the same data but with different struct.
The Word document have the results that I would like.
Notice that each page has a header and footer different (sections)

Courses.zip (21.8 KB)
Thank you

@VictorMDiego

Your expected document contains the section break. Unfortunately, LINQ Reporting engine does not support section break inside foreach tag. This feature was logged as WORDSNET-17026 in our issue tracking system.

Please share your template document and create a standalone console application ( source code without compilation errors ) that helps us to generate the output document without section break. We will investigate the issue and provide you more information on it.

I do not use C# as language, so I attach the WinDEV_Program.txt as an example of source code (It is very simple, just to call “BuildReport” method. I hope you understand it)

The other files I attach are the JSON file with data and the template
I am testing Aspose.Words to know if it is a valid tool for us a buy it. I am not an expert in Aspose tools nor LINQ

Courses_Test.zip (16.2 KB)

@VictorMDiego

You are getting the correct output using Aspose.Words. You can have different header and footer for first page and other pages. You just need to enable ‘Different First Page’ option as shown in attached image. Different First Page.png (24.3 KB)

We have attached the modified input document and output document with this post for your kind reference. Docs.zip (29.7 KB)

Moreover, you can use the different header footer types. Please check the HeaderFooterType enumeration.

Thank you for the information. If in a future you develop the functionality of LINQ engine in order to incorporate a “section break” function inside a “foreach” it would be great.

Another question, please, how can I change the encode od the data source?. The json file is in ANSI, so, is there any function or parameter to merge the data appropriately?.

@VictorMDiego

We will inform you via this forum thread once WORDSNET-17026 feature is available.

You can use Encoding of Json as shown below. Hope this helps you.

var dataStream = new MemoryStream(Encoding.ASCII.GetBytes(json));
var jsonDataSource = new JsonDataSource(dataStream, options);

The issues you have found earlier (filed as WORDSNET-17026) have been fixed in this Aspose.Words for .NET 21.1 update and this Aspose.Words for Java 21.1 update.