MohamedSaeed / xdocreport

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

Logical AND(&&) and OR(||) throw an error while converting odt to pdf #375

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Use if statement in odt template with logical AND and OR
2.Try to convert it to pdf using xdocreport library.

What is the expected output? What do you see instead?
It should convert the file successfully to pdf.
I get this error instead
Lexical error,   Encountered: "a" (97), after : "&" at 
fr.opensagres.xdocreport.document.odt.ODTReport@469d4b24!content.xml[line 1, 
column 2345]
org.apache.velocity.exception.ParseErrorException: Lexical error,   
Encountered: "a" (97), after : "&" at 
fr.opensagres.xdocreport.document.odt.ODTReport@469d4b24!content.xml[line 1, 
column 2345]
    at org.apache.velocity.Template.process(Template.java:151)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:437)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
    at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
    at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:392)
    at fr.opensagres.xdocreport.template.velocity.internal.VelocityTemplateEngine.processWithCache(VelocityTemplateEngine.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:775)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:703)

What version of the product are you using? On what operating system?
XDocReport-1.0.4
Windows 7
Word 2010
JDK 7

Please provide any additional information below.
I have attached the odt template herewith.

Original issue reported on code.google.com by harshald...@gmail.com on 27 Feb 2014 at 7:55

Attachments:

GoogleCodeExporter commented 9 years ago
Your problem is because you don't use input field. I suggest you to start to 
read https://code.google.com/p/xdocreport/wiki/ODTReportingQuickStart

Original comment by angelo.z...@gmail.com on 27 Feb 2014 at 9:23

GoogleCodeExporter commented 9 years ago
I tried editing it as <fill-in> type of field still it doesn't work.
I am using Word 2010 to edit the template. Can you please attach some very 
basic sample here?
Thanks!

Original comment by harshald...@gmail.com on 27 Feb 2014 at 10:33

GoogleCodeExporter commented 9 years ago
I don't understand. Your attached document is odt and you use MS Word? 

 * if you wish to use odt, you must use LibreOffice/OppenOffice. Please read https://code.google.com/p/xdocreport/wiki/ODTReportingQuickStart
 * if you wish to use docx, you must use MS Word. Please read https://code.google.com/p/xdocreport/wiki/DocxReportingQuickStart

Original comment by angelo.z...@gmail.com on 27 Feb 2014 at 10:37

GoogleCodeExporter commented 9 years ago
Yes it can be edited in MS word right? If I don't use && and || then it just 
works perfectly fine with XDocReport. I am not sure why && and || is creating 
an issue here. What is the recommended editor for ODT templates then (if word 
isn't supported)?

Original comment by harshald...@gmail.com on 27 Feb 2014 at 10:40

GoogleCodeExporter commented 9 years ago
I suggest you read really the wiki. When you want add your Freemarker/velocity 
syntax in the odd/docx you MUST NOT type it directly the expression because 
odt/docx encoded teh expression. To avoid encoding the expression, you must : 

 * use "input field" for ODT.
 * use "mergefield" for DOCX.

With MS Word you can open an ODT, right, but you cannot use "input field". So : 

 * if you want to have a template written in ODT, use OpenOffice/LibreOffice to have the capability to create "input field".
 * if you want to have a template written in DOCX, use MS Word to have the capability to create "mergefield".

Original comment by angelo.z...@gmail.com on 27 Feb 2014 at 11:04

GoogleCodeExporter commented 9 years ago
None anwser. I close this issue.

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 3:25

GoogleCodeExporter commented 9 years ago
cleanup

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