I am trying to create a document where the marked portion of the word will be replaced with property value. I am able to achieve this with concrete class. But in out scenario the class is dynamic. So I am trying the same with Expandoobject. But it is throwing an error.
System.InvalidOperationException: 'An error has been encountered at the end of expression ‘document.Name]>’. Can not get the value of member ‘Name’ on type 'Aspose.ExpandoWrapper
Here is my code. How can I acheive this dynamically.?
Document doc = new Document(dataDir + fileName);
// Create a Reporting Engine.
ReportingEngine engine = new ReportingEngine();
var data = Common.GetManager();
dynamic wrapper = new ExpandoWrapper(data); // convert class to dynamic object.
Console.WriteLine(wrapper.Name); // I have the data here
// Execute the build report.
engine.BuildReport(doc, wrapper, "document"); // error
dataDir = dataDir + GetOutputFilePath(fileName);
// Save the finished document to disk.
doc.Save(dataDir);
Unfortunately, Aspose.Words does not support dynamic data sources in LINQ Reporting engine. However, we logged this feature request as WORDSNET-16017 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.
Could you please attach the following resources here for testing:
Your input Word document.
Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.
We will investigate the issue and log it according to your requirement.
PS: To attach these resources, please zip and upload them.
At the moment, working on this feature is postponed. However, you can use the approach involving JsonDataSource to work with dynamic objects using LINQ Reporting Engine.