Does XDocReport accepts only POJOs as a list of feeds of data?

33 views
Skip to first unread message

Silas Silva

unread,
Feb 21, 2017, 2:16:44 PM2/21/17
to xdocreport
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?

Angelo zerr

unread,
Feb 21, 2017, 2:22:48 PM2/21/17
to xdocr...@googlegroups.com
2017-02-21 20:14 GMT+01:00 Silas Silva <sil...@gmail.com>:
Hi all!

I'm using XDocReport for ODT report generation. Angelo, thanks for such a great tool!

Thanks!
Yes you should use an HashMap



Regard's Angelo

 

--
You received this message because you are subscribed to the Google Groups "xdocreport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xdocreport+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages