Hi Xavier,

This boolean issue was resolved a year ago, I have to investigate why the fix was not
included included in jOpenDocument!
The fix will be in the next release (which will come soon).

Thank you for pointing  us this issue!

I hope the library will fit your needs.

Regards,
Guillaume

Hi,

yes my paragraph is named "p1" (it is test.odt document from the
sources) and for the versions, i've tried this ones :
- JDK5
# Version 1.1 , October 10, 2008 jOpenDocument-1.1-jdk5.jar  (Java 5)
# Version 1.2 beta 2, August 13, 2009 jOpenDocument-1.2b2-jdk5.jar
(Java 5)
- JDK6
# Version 1.1 , October 10, 2008 jOpenDocument-1.1.jar  (Java 6)
# Version 1.2 beta 2, August 13, 2009 jOpenDocument-1.2b2.jar  (Java
6) -- recommended version --

the behaviour is always the same for RhinoFileTemplate...

The problem come from the methods showParagraph & hideParagraph.
Fields showParagraph_XX are set like this :
    public void showParagraph(String name) {
        this.setField("showParagraph_" + name, "true");
    }

    public void hideParagraph(String name) {
        this.setField("showParagraph_" + name, "false");
    }

If you replace "true" by Boolean.TRUE and "false" by Boolean.FALSE (as
in JavaScriptFileTemplate), then the test is evaluated correctly and
it works, no need to modify manually the script in the odt document.

If you still maintain the JDK5 version in the next release, maybe you
could integrate this correction...

Personnally, I abandonned my first workaround and implement a simple
template extending RhinoFileTemplate and overriding the methods
showParagraph & hideParagraph like this :
    public void showParagraph(String name) {
        this.setField("showParagraph_" + name, Boolean.TRUE);
    }

    public void hideParagraph(String name) {
        this.setField("showParagraph_" + name, Boolean.FALSE );
    }

However, it's a very good api, very usefull and simple to integrate.
Exactly what I was expected :)

Thank you very much and bravo!

Regards

On 23 fév, 19:12, "jOpenDocument, Guillaume" <g...@jopendocument.org>
wrote:
Hi,

It seems to be an issue in Rhino which is not evaluating the test
as it should.
Did you try the JDK6 version?
Is your paragraph named "p1"?

Regards,
Guillaume

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 <xjul...@gmail.com> 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.

Reply via email to