It seems that I have my workaround :) When you tag a paragraph in ooo with the addon, a script is generated, accessible by double-clicking on the "green thing". For example, if the paragraph is called p1, the generated script is : <if test="showParagraph_p1" element="p"/>
But with RhinoFileTemplate, the test is always false and the paragraph is never shown :( But it works if you modify manually the script like this : <if test="showParagraph_p1 == 'true'" element="p"/> Hope it helps. On 23 fév, 15:28, Xavier JULIEN <[email protected]> wrote: > Hi all, > > I've a problem with the RhinoFileTemplate class. > Paragraph showing or hiding doesn't seem to work with this template on > jdk1.5. > > I've tried different release of JOpenDocument (1.1, 1.1-jdk5, 1.2, 1.2- > jdk5...) but the paragraph is never shown with the RhinoFileTemplate > wheras there is not problem with JavascriptFileTemplate and jdk1.6. > > My code is quite simple, it's the same as in TestTemplate from the src > release, I've just replaced hideParagraph by showParagraph. I didn't > modified the template file "test.odt", it's the one packaged with the > sources. > The code : > > File templateFile = new File("test.odt"); > File outFile = new File("out.odt"); > // Load the template. > RhinoFileTemplate template = new > RhinoFileTemplate(templateFile); > > // Fill with sample values. > template.setField("toto", "value set using setField()"); > final List<Map<String, String>> months = new > ArrayList<Map<String, String>>(); > months.add(createMap("January", "-12", "3")); > months.add(createMap("February", "-8", "5")); > months.add(createMap("March", "-5", "12")); > months.add(createMap("April", "-1", "15")); > months.add(createMap("May", "3", "21")); > template.setField("months", months); > > template.showParagraph("p1"); > > // Save to file. > template.saveAs(outFile); > > // Open the document with OpenOffice.org ! > OOUtils.open(outFile); > > I've seen on this > topichttp://groups.google.com/group/jopendocument/browse_thread/thread/867..., > that someone had the same problem... > > Is there any solution or work around ? An easy way to override > RhinoFileTemplate maybe ? > > Thanks in advance.
