MohamedSaeed / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

Field is not declared when mixing style and list in FieldsMetadata #276

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I am on Windows with version 1.0.0
I generate for ODT with Freemarker
I tried to have a list with html field inside but I have errors.

If I had my field this way (seen in bug 241),"metadata.addField( "titre", 
Boolean.TRUE, null, SyntaxKind.Html.name(), false );", I have this error:

Caused by: freemarker.core.ParseException: Token manager error: 
freemarker.core.TokenMgrError: Lexical error at line 3, column 19272.  
Encountered: "#" (35), after : "" in 
fr.opensagres.xdocreport.document.odt.ODTReport@1899ebf!con
tent.xml
        at freemarker.template.Template.<init>(Template.java:152)
        at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:457)
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:370)
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:238)
        at freemarker.template.Configuration.getTemplate(Configuration.java:493)
        at freemarker.template.Configuration.getTemplate(Configuration.java:458)
        at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:97)
        at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
        at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:772)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:518)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:484)
        at com.bluexml.generation.xdocreport.XDocReportTemplateGenerator$XDocReportTemplateGeneratorJob.transform(XDocReportTemplateGenerator.java:182)
        at com.bluexml.generation.xdocreport.XDocReportTemplateGenerator.transform(XDocReportTemplateGenerator.java:190)
        ... 80 more

and If I don't had them, I have this error:

Caused by: fr.opensagres.xdocreport.core.XDocReportException: 
freemarker.core.InvalidReferenceException: Expression liste_delibA_titre is 
undefined on line 3, column 19252 in 
fr.opensagres.xdocreport.document.odt.ODTReport@6565a3!c
ontent.xml.
        at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.process(FreemarkerTemplateEngine.java:153)
        at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:99)
        at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
        at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:772)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:518)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:484)
        at com.bluexml.generation.xdocreport.XDocReportTemplateGenerator$XDocReportTemplateGeneratorJob.transform(XDocReportTemplateGenerator.java:182)
        at com.bluexml.generation.xdocreport.XDocReportTemplateGenerator.transform(XDocReportTemplateGenerator.java:190)
        ... 80 more
Caused by: freemarker.core.InvalidReferenceException: Expression 
liste_delibA_titre is undefined on line 3, column 19252 in 
fr.opensagres.xdocreport.document.odt.ODTReport@6565a3!content.xml.
        at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
        at freemarker.core.IteratorBlock.accept(IteratorBlock.java:100)
        at freemarker.core.Environment.visit(Environment.java:221)
        at freemarker.core.MixedContent.accept(MixedContent.java:92)
        at freemarker.core.Environment.visit(Environment.java:221)
        at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
        at freemarker.core.Environment.visit(Environment.java:221)
        at freemarker.core.MixedContent.accept(MixedContent.java:92)
        at freemarker.core.Environment.visit(Environment.java:221)
        at freemarker.core.Environment.process(Environment.java:199)
        at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.process(FreemarkerTemplateEngine.java:149)
        ... 88 more

And if I don't use FieldsMetadata it works, but I have html tags in my odt.

Thanks a lot,
Ladislas

Original issue reported on code.google.com by ladislas...@gmail.com on 14 Jun 2013 at 10:51

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

At first next time, please attach a simplified java code (just a java main 
which works with your problem) and explain more what you wish to do in order I 
don't try and guess your need.

Last release is 1.0.2.

If I have understood your problem, you have :

------------------------------------------------------------------
[#list delibParService.deliberations as deliberation]${deliberation}
[/#list]
------------------------------------------------------------------

and ${deliberation} contains HTML. If

Your XDocReportTemplateGenerator declare fields metadata like this : 

------------------------------------------------------------------
metadata.addField( "deliberation", Boolean.TRUE, null, SyntaxKind.Html.name(), 
false );
------------------------------------------------------------------

But it's not correct. You have setted the list type as Boolean.TRUE which is 
used for lazy loop table (XDocReport will transform your field with 
${item_deliberation}

In your case you manag eloop at hand, so you must not set it as list type. Try 
like this :

------------------------------------------------------------------
metadata.addField( "deliberation", false, null, SyntaxKind.Html.name(), false );
------------------------------------------------------------------

You have declared 

------------------------------------------------------------------
metadata.addField( "titre", Boolean.TRUE, null, SyntaxKind.Html.name(), false );
------------------------------------------------------------------

but I don't see this field name in the odt?
Regards Angelo

Original comment by angelo.z...@gmail.com on 14 Jun 2013 at 12:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sorry for the full java code!
Thanks for your reply, I test it as soon as I can.
Regards Ladislas

Original comment by ladislas...@gmail.com on 14 Jun 2013 at 1:54

GoogleCodeExporter commented 9 years ago
So I changed 
---------------------------------------
metadata.addField( "titre", Boolean.TRUE, null, SyntaxKind.Html.name(), false );
metadata.addField( "deliberation", Boolean.TRUE, null, SyntaxKind.Html.name(), 
false );
---------------------------------------
to
---------------------------------------
metadata.addField( "delibParService.titre", false, null, 
SyntaxKind.Html.name(), false );
metadata.addField( "deliberation", false, null, SyntaxKind.Html.name(), false );
---------------------------------------

and I use version 1.0.2.

I still get the same error:
Caused by: freemarker.core.ParseException: Token manager error: 
freemarker.core.TokenMgrError: Lexical error at line 3, column 19272.  
Encountered: "#" (35), after : "" in 
fr.opensagres.xdocreport.document.odt.ODTReport@1899ebf!content.xml
        at freemarker.template.Template.<init>(Template.java:152)
        at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:457)
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:370)
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:238)
        at freemarker.template.Configuration.getTemplate(Configuration.java:493)
        at freemarker.template.Configuration.getTemplate(Configuration.java:458)
        at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:97)
        at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
        at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:772)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:518)
        at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:484)
        at com.bluexml.generation.xdocreport.XDocReportTemplateGenerator$XDocReportTemplateGeneratorJob.transform(XDocReportTemplateGenerator.java:182)
        at com.bluexml.generation.xdocreport.XDocReportTemplateGenerator.transform(XDocReportTemplateGenerator.java:190)
        ... 80 more

Original comment by ladislas...@gmail.com on 14 Jun 2013 at 3:33

GoogleCodeExporter commented 9 years ago
Ok, I'm waiting for simple Java main which causes the problem.

Regards Angelo

Original comment by angelo.z...@gmail.com on 16 Jun 2013 at 4:14

GoogleCodeExporter commented 9 years ago
Thanks Angelo,
Here you go. I use the same synthetiqueTemplate.odt as the one I uploaded 
previously.

Regards Ladislas

Original comment by ladislas...@gmail.com on 17 Jun 2013 at 9:53

Attachments:

GoogleCodeExporter commented 9 years ago
Hello Angelo,
You can close it, I use lazy loop table or simple html field where I merge all 
my datas in Java. It is easier for me even if final user can less modify 
documents' template.
By the way, does xdocreport handle html table ?

Regards Ladislas

Original comment by ladislas...@gmail.com on 24 Jul 2013 at 3:45

GoogleCodeExporter commented 9 years ago
Hi Ladislas,

I close this issue. HTML table are not supported by XDocReport. I would like to 
support it when I will have time to do that.

Regards Angelo

Original comment by angelo.z...@gmail.com on 24 Jul 2013 at 3:49

GoogleCodeExporter commented 9 years ago
cleanup

Original comment by pascal.leclercq on 10 Oct 2014 at 7:37