Hiho,
we are currently implementing a feature that uses Aspose Words for Java and is based on the LINQ reporting engine. We have a requirement to produce runtime varying returns as a result of calls to tags used in the template.
For this we provide a DataSource on which, for example, a method Object get(String type);
is defined. When this method is called, the method returns different concrete implementations based on the parameter passed.
These types can be not only primitive types, but also complex types that we have implemented ourselves. These complex types in turn provide methods that should be callable. For example, it should be possible to call <<[ds.get("Person").getName()]>>
.
However, when the ReportingEngine is executed, an error occurs stating that no method with the name getName()
can be found on the class Object
. And this happens even though the get(...)
method returns at runtime an instance of type Person
that has a getName()
method implemented.
So it seems that Aspose does not evaluate the runtime type but the static type defined on the respective class.
I found an old ticket about the problem:
https://forum.aspose.com/t/how-define-type-in-runtime-for-reportingengine/183756
This is unfortunately not helpful (we don’t want to have to tell the user to cast objects, for example) nor can I find the reference WORDSNET-17506 anywhere (not to mention that it is a .NET relevant ticket, but the problem was described in the context of Java).
Any help to solve the problem and to enable dynamic object hierarchy as a DataSource while executing the ReportingEngine is most welcome.