Hi all!
I'm using XDocReport for ODT report generation. Angelo, thanks for such a great tool!
I'm using Freemarker parser. It works pretty fine for documents with single values, like:
Name: ${name}
Age: ${age}
...
The problem arises when I want to create a list of people:
(This is a table)
Name / Age
${
person.name} / ${person.age}
It works pretty fine if I use Person POJO as stated in the wiki examples:
IContext context = report.createContext();
List<Person> personlist = new ArrayList<Person>();
while (...) {
fill in the list...
}
context.put("person", personlist);
As I said, it works, but I have a problem: I cannot predict the kind of class I'm going to use because it will be a dynamic solution. The user will insert both the SQL and the template and get the report rendered. Since I don't know previously what data will be fetched from the SQL, I cannot hardcode POJOs.
And it seems that an IContext object put() method always require an Object with information it is going to fetch, right? Could I work with something like a List of HashMaps or something like that?
Thanks!
P.S.: Further research discovers that it seems a limitation of Freemarker. What Freemarker features may help with this problem? Maybe Object wrappers?