Re: #include freemarker directive to include a docx file

226 views
Skip to first unread message

Angelo zerr

unread,
Mar 9, 2013, 6:16:33 AM3/9/13
to xdocr...@googlegroups.com
I have never do that and today I have no time to investigate about this topic.

I suppose the problems comes from that we have implemented our own template loader XDocReportEntryTemplateLoader (see config at 

but not sure for that.

If you find an issue to fix your problem, don(t hesitate to post your solution. If XDocReport should be improved to support #include, don't hesitate to create a patch.
Many thank's.

Good luck!

Regards Angelo

2013/3/9 Mark De Souza <markcd...@gmail.com>
Hi,

I am trying to use the #include directive to include a separate docx file in my main docx report.  Every time I attempt to do this I get an error.

If I set the "working directory" via FreemarkerTemplateEngine.getFreemarkerConfiguration().setDirectoryForTemplateLoading(File):
freemarker.template.TemplateException: Error reading included file word/<included filename>
    at freemarker.core.Include.accept(Include.java:167)
    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)

If I reference the full path with the filename in the #include directive:
freemarker.template.TemplateException: Error parsing included template <included filename with full path>
Token manager error: freemarker.core.TokenMgrError: Lexical error at line 114, column 17.  Encountered: "\ufffd" (65533), after : "" in <included filename with full path>
    at freemarker.core.Include.accept(Include.java:162)
    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)

I could of course just use word to include the file (ie without the using the template engine) but it appears that you need to refresh the field in parent docx each time you make a change to the included docx.

Any advise would greatly be appreciated.

Regards,
Mark

--
You received this message because you are subscribed to the Google Groups "xdocreport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xdocreport+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Angelo zerr

unread,
Mar 9, 2013, 6:40:07 AM3/9/13
to xdocr...@googlegroups.com
I have read too quicly your problem.

You cannot use #include to merge several docx. Merging docx is more hard than a simple inclusion.

Regards Angelo

2013/3/9 Angelo zerr <angel...@gmail.com>
Reply all
Reply to author
Forward
0 new messages