How to create dynamic table with different cells using Aspose Linq Reposrting engine on docx

I need to generate a table dynamically in docx document using linq reporting engine. Table should be like the below. I can loop through a json which is having the information but not able to create different rows with different cells .
image.png (3.3 KB)

I used in the below way

But it’s throwing me the error while rendering the word into PDF using Aspose.
Error is: "Cannot copy content between cell or tables. "

@arindamk Could you please attach your sample template and data here for testing? We will check the issue and provide you more information.

Hi @alexey.noskov :- sorry for the delayed response. Please find the problem statement in the below file. I mentioned my requirement and also the sample template. Please let me know if you need any more details:
Problem.docx (18.0 KB)

@arindamk To get the expected output you should change your data source like the following:

{
  "data": [
    {
      "Column1": "Row1",
      "Column2": "1",
      "Column3": "6"
    },
    {
      "Column1": "Row2",
      "Column2": "2",
      "Column3": "7"
    },
    {
      "Column1": "Row3",
      "Column2": "3",
      "Column3": "8"
    },
    {
      "Column1": "Row4",
      "Column2": "5",
      "Column3": "9"
    },
    {
      "Column1": "Row5",
      "Column2": "5",
      "Column3": "10"
    }
  ]
}

In this case you will be able to use the following syntax:

Please see the following code and files:

Document doc = new Document(@"C:\Temp\in.docx");
JsonDataSource data = new JsonDataSource(@"C:\Temp\data.json", new JsonDataLoadOptions() { AlwaysGenerateRootObject = true });
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, data);
doc.Save(@"C:\Temp\out.docx");

in.docx (15.3 KB)
data.zip (262 Bytes)
out.docx (10.9 KB)

Thanks @alexey.noskov . I will try to change the source JSON format.

But earlier I used that foreach loop inside one call and tried to use the element under same object (item) in the other two cells. That time, I got the error like:
Content cannot be copied from one cell or source to another - something like that. However, I would try once again and let you know.

@arindamk I have tested with the above provide template, data and code and everything works as expected on my side.

Hi @alexey.noskov - Thanks for the confirmation.

Could you please confirm me one more thing? - Does aspose support the below format of token in the template

token name : <<[BASICINFO-POLICYNUMBER]>>
even I tried with this - <<[data.”BASICINFO-POLICYNUMBER”]>>
and neither it’s supporting ‘_’ as separator. I’ve large token path. I need those to be separated using some character.
I’m getting an error: “Error! Can not apply operator ‘-’ to operands of type ‘System.Object’ and ‘System.Object’.”

@arindamk No, you cannot use "-" in entity name. Names of entities must follow the same rules as names of variables in C#.
https://docs.aspose.com/words/net/linq-reporting-engine-features/

There should not be any problems with underscores:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("<<[name_with_underscore]>>");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, "This is my cool value", "name_with_underscore");
doc.Save(@"C:\Temp\out.docx");