it works! the problem was the field i inserted. i watched your sample-
templates and copied the javascript-code and voila :)
thanks.

On 9 Jun., 11:43, "richard.kul...@googlemail.com"
<richard.kul...@googlemail.com> wrote:
> thanks for the fast reply.
> I created a table with a header and one empty line in the template, as
> you told. I inserted the green thing "repeat table row" directly after
> the table with the values
> Java Collection: ArrayList
> Expose the items of your collection: ArrayList
>
> In Java, i created an ArrayList<ArrayList<String>> connections = new
> ArrayList<ArrayList<String>>();
>
> But when want to read the template with
> JavaScriptFileTemplate template = new JavaScriptFileTemplate(new File
> ("ootemplates/letter_template.odt"));
>
> i get this error:
> Exception in thread "main"
> org.jopendocument.dom.template.TemplateException: no such element
> enclosing forEach: table-row for expression: ArrayList
>         at org.jopendocument.dom.template.statements.ForEach.prepare(Unknown
> Source)
>         at org.jopendocument.dom.template.statements.BaseStatement.prepare
> (Unknown Source)
>         at org.jopendocument.dom.template.engine.Parsed.prepare(Unknown
> Source)
>         at org.jopendocument.dom.template.engine.Parsed.<init>(Unknown
> Source)
>         at org.jopendocument.dom.template.engine.Parsed.<init>(Unknown
> Source)
>         at org.jopendocument.dom.template.Template.<init>(Unknown Source)
>         at org.jopendocument.dom.template.Template.<init>(Unknown Source)
>         at org.jopendocument.dom.template.FileTemplate.<init>(Unknown Source)
>         at org.jopendocument.dom.template.JavaScriptFileTemplate.<init>
> (Unknown Source)
>         at OpenDoc.main(OpenDoc.java:16)
>
> What's wrong??
>
> On 8 Jun., 19:24, Guillaume Maillard <guillaume.maill...@gmail.com>
> wrote:
>
> > Hi,
> > You just need to create a template with the header and 1 line.
> > Look at the OO plugin to insert the correct "green thing".
> > With this method, you will just have to provide from Java a collection of
> > objects
> > that you want to put in your table.
>
> > Regards,
> > Guillaume
>
> > 2009/6/8 richard.kul...@googlemail.com <richard.kul...@googlemail.com>
>
> > > Hello Open Officers!
>
> > > I want to create an .odt with a table of unknown length (at compile
> > > time) and a header of course. How would you do this? Do I create the
> > > table from java or in the odt-template?
>
> > > thanks
> > > richard

Reply via email to