Issue 275 in xdocreport: Problem processing the docx as Velocity Template

564 views
Skip to first unread message

xdocr...@googlecode.com

unread,
Jun 12, 2013, 5:43:35 AM6/12/13
to xdocr...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 275 by dseg...@dset-solutions.com: Problem processing the docx as
Velocity Template
http://code.google.com/p/xdocreport/issues/detail?id=275

What steps will reproduce the problem?

1.Take the attached docx file
2.Try to parse it
3. Will throw exception

What is the expected output? What do you see instead?
org.apache.velocity.exception.ParseErrorException: Lexical error,
Encountered: "\u00bb" (187), after : "" at
fr.opensagres.xdocreport.document.docx.DocxReport@5c57a5e9!word/document.xml[line
1, column 25219]
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:96)
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.dset.greenleaf.report.GLReportDocx.generate(GLReportDocx.java:102)


What version of the product are you using? On what operating system?
1.0.2 on Linux

Please provide any additional information below.

Word generated with Microsoft Word 2010 Version: 14.0.6023.1000 (32bits)


Attachments:
ReportPolissaCat.docx 44.8 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

xdocr...@googlecode.com

unread,
Jun 12, 2013, 5:52:33 AM6/12/13
to xdocr...@googlegroups.com
Updates:
Status: Accepted
Owner: angelo.z...@gmail.com

Comment #1 on issue 275 by angelo.z...@gmail.com: Problem processing the
I have seen your docx and it is very complex. So it's very hard to debug
your problem. More I have not your Java context. So it's impossible for me
to help you.

I cannot take time to find your problem. The only solution is to try to
generate your report step by step by removing some contents and see what is
your problem.

If you find your problem with a simple docx, I could help you.
Good lucks!

Regards Angelo

xdocr...@googlecode.com

unread,
Jun 12, 2013, 6:04:10 AM6/12/13
to xdocr...@googlegroups.com

Comment #2 on issue 275 by dseg...@dset-solutions.com: Problem processing
Ok thank you for your fast replay, I'm going to try to generate my report
step by step.

Regards

Dolors


--

*Dolors Segura*
*�rea de software
*697.429.220 / 972.104.177 (Ext. 2) - dse...@dset-solutions.com

*DSET Solutions *
*Parc Cient�fic i Tecnol�gic de la UdG - 17003 Girona*
http://www.dset-solutions.com
<http://www.dset-solutions.com/es/avis-legal.html>

Av�s
legal<http://www.dset-solutions.com/index.php?option=com_content&id=159&view=article&lang=ca>

xdocr...@googlecode.com

unread,
Jun 12, 2013, 7:35:01 AM6/12/13
to xdocr...@googlegroups.com

Comment #3 on issue 275 by dseg...@dset-solutions.com: Problem processing
Angelo I found the same error in this simple docx.

org.apache.velocity.exception.ParseErrorException: Lexical error,
Encountered: "\u00bb" (187), after : "" at
fr.opensagres.xdocreport.document.docx.DocxReport@1e64621f!word/document.xml[line
1, column 12154]
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:96)
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.dset.greenleaf.report.GLReportDocx.generate(GLReportDocx.java:102)


Java Code:

IXDocReport report =
XDocReportRegistry.getRegistry().loadReport(reportSource,
TemplateEngineKind.Velocity);

FieldsMetadata metadata = new FieldsMetadata();
addListParameters(metadata);
report.setFieldsMetadata(metadata);

IContext context = report.createContext();
Map parameters = getParameters();
Set<String> keySet = parameters.keySet();
Iterator<String> it = keySet.iterator();
while (it.hasNext()) {
String key = it.next();
context.put(key, parameters.get(key));
}

// Data --> empty List
context.put("rows", data);

report.process(context, out);


Thanks,

Dolors

xdocr...@googlecode.com

unread,
Jun 12, 2013, 9:34:47 AM6/12/13
to xdocr...@googlegroups.com

Comment #4 on issue 275 by angelo.z...@gmail.com: Problem processing the
OK, could you attach please your docx and your Java code (main + context
which works) in order to I can debug it. Without that I cannot help you.

xdocr...@googlecode.com

unread,
Jun 12, 2013, 10:09:50 AM6/12/13
to xdocr...@googlegroups.com

Comment #5 on issue 275 by dseg...@dset-solutions.com: Problem processing
Sorry, this is a zip with the example code and my docx.

Thanks,

Dolors



Attachments:
ExampleXDocReport.zip 1.7 MB

xdocr...@googlecode.com

unread,
Jun 16, 2013, 8:06:37 PM6/16/13
to xdocr...@googlegroups.com

Comment #6 on issue 275 by angelo.z...@gmail.com: Problem processing the
Hi Dolors,

It was a bug with XDocReport. I have fixed the problem (see Git commit
https://code.google.com/p/xdocreport/source/detail?r=9f0eea707d26c6114443d99d86f071c1fdacd051)

The problem was that you have an hyperlink and XDocReport didn't
reinitialize it and you had your problem. The problem is fixed for 1.0.3.

xdocr...@googlecode.com

unread,
Jun 20, 2013, 5:49:14 AM6/20/13
to xdocr...@googlegroups.com

Comment #7 on issue 275 by dolma...@gmail.com: Problem processing the docx
Hi Angelo,

It fix the problem, thank you very much!

Dolors

xdocr...@googlecode.com

unread,
Jun 20, 2013, 8:34:28 AM6/20/13
to xdocr...@googlegroups.com
Updates:
Status: Fixed

Comment #8 on issue 275 by angelo.z...@gmail.com: Problem processing the
Hi Dolors;

OK that's cool. I close this issue.

Regards Angelo

Kamal C

unread,
Oct 17, 2016, 2:07:15 AM10/17/16
to xdocreport, codesite...@google.com, xdocr...@googlecode.com

erorParsing error in template "fr.opensagres.xdocreport.document.docx.DocxReport@47f37ef1!word/document.xml" in line 4, column 755:
Encountered "/", but was expecting one of:
    <STRING_LITERAL>
    <RAW_STRING>
    "false"
    "true"
    <INTEGER>
    <DECIMAL>
    "."
    "+"
    "-"
    "!"
    "["
    "("
    "{"
    <ID>

Hi, I am getting this kind of error. I have just two place holder ${name} and ${country} . With one placeholder it repalces well. But not with 2 placeholders.
Reply all
Reply to author
Forward
0 new messages