Free Support Forum - aspose.com

Not able to pull property from table column with LINQ Reporting Engine

Hi,


I am attempting to evaluate Aspose for our purposes and I’m running into an issue with the LINQ Reporting Engine. When I try to run the code below I keep getting an error that the engine cannot find the column name as defined in my DataTable. I have checked a few other posts on this forum and see similar syntax and object usage so I’m not sure what I’m doing wrong here. Please let me know if someone could be of assistance.

Code Snippet:

ReportingEngine engine = new ReportingEngine();

DataTable FieldNamesValues = new DataTable();
FieldNamesValues.Columns.Add(“Name”);
FieldNamesValues.Columns.Add(“Value”);
foreach (string sKey in reportFields.Keys)
FieldNamesValues.Rows.Add(sKey, reportFields[sKey]);
engine.BuildReport(doc, FieldNamesValues, “ds”);

doc.Save(“out.docx”);

Word Template:

This is an example
from a Data Set object:

<>

Note that the code fails when looking for ds.Name so it's not finding the column I've added to the data table.


Thanks,

Mike

I just met with a colleague and we figured it out. I was attempting to pull from the Name collection like it was a dictionary. I realize I just misunderstood how the objects were being brought into the template.

Hi Mike,


Thanks for your inquiry. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

PS: Please refer to LINQ Reporting Engine Programmers Guide:
http://www.aspose.com/docs/display/wordsnet/LINQ+Reporting+Engine+Programmers+Guide

Best regards,