Issue 341 in xdocreport: docx->xhtml, is there any good way to locate the image?

102 views
Skip to first unread message

xdocr...@googlecode.com

unread,
Dec 12, 2013, 7:11:05 AM12/12/13
to xdocr...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 341 by yynora...@gmail.com: docx->xhtml, is there any good way to
locate the image?
http://code.google.com/p/xdocreport/issues/detail?id=341

What steps will reproduce the problem?
1.I used the sample supplied with "docxandfreemarker-1.0.3-sample.zip" to
produce a docx with some images.
2.I downloaded the "docx.converters-1.0.3-sample.zip" and created a java
project to run the sample.
3.When I tried to convert the docx file to xhtml, I found that the images
didn't show up in the htm file.

What is the expected output? What do you see instead?
The reason for the image not showing is that the html can not locate them.
I noticed that the uri of the images changed to something
like "file:///home/user/workspace/XdocReport/temp/word/media/xdocreport_0.jpg".
As you can see the image name had nothing to do with the bookmark name
which I set in the docx template before. They were just named in the
way "xdocreport_N.jpg" one after another, where the "N" stood for an
increasing number starting from "0". And the "XHTMLOptions" was not quite
useful. When I set it with the value "temp", the image searching path would
be "projectRootPath/temp/word/media". Don't you think it's very
inconvenient? Why not just use the image bookmark name as the html image
name and set the path with the option value without the
additional "word/media" subdirectory? I looked up through the whole
existing issues but still didn't figure it out. Did I miss something? What
I need is just a good way to locate the html image. Right now I have to
change all the names of the images that I used and put them in
the "xxx/word/media" directory which makes me feel awful.

What version of the product are you using? On what operating system?
The version of the product is 1.0.3.
ubuntu 12.04 64bit jre 1.6
Please provide any additional information below.
I do not want to give up xdocreport, because I find it's really faster than
dox4j or something else. You all really did a good job. I'm trying to help
it become more better.

Regards
yy


--
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,
Dec 12, 2013, 8:47:04 AM12/12/13
to xdocr...@googlegroups.com
Updates:
Status: Accepted
Owner: angelo.z...@gmail.com

Comment #1 on issue 341 by angelo.z...@gmail.com: docx->xhtml, is there any
Hi YY,

OK I will add sample "docxandfreemarker.converters-xxx-sample.zip" with a
sample with images.

Do you have setted a custom URIResolver? An IImageExtractor? I have added a
little section now at
https://code.google.com/p/xdocreport/wiki/XWPFConverterXHTML#Manage_image

For "word/media" question, I have done, because in our demo we use a
generic WebUriResolver (works with odt and docx) which search image stream
in the memory (from XDocArchive). So for docx "word/media" is required. But
if you customize your URIResolver you can remove it.

Regards Angelo

xdocr...@googlecode.com

unread,
Dec 12, 2013, 2:24:37 PM12/12/13
to xdocr...@googlegroups.com

Comment #2 on issue 341 by yynora...@gmail.com: docx->xhtml, is there any
Thank you Angelo for the in time reply! Yes, I've seen the little section
that you mentioned above. With the hint of the update content in "XHTML
Settings" part,I finally managed it(extract the image to some folder and
set the URI resolver with it, that's all) . The result of htm convertion is
perfect. I never feel like xdocreport so much! Thanks a ton! Looking
forward your new sample about the docxfreemarker converters. Then no one
will be confused on this point.Good job!

Regards YY

xdocr...@googlecode.com

unread,
Dec 12, 2013, 3:15:51 PM12/12/13
to xdocr...@googlegroups.com

Comment #3 on issue 341 by angelo.z...@gmail.com: docx->xhtml, is there any
Many thank's YY. It's a pleasure to see that some people like you likes
XDocReport.

But pay attention, the docx->xhtml converter (like other converters) are
not perfect. There are again a lot of issues to do (manage table border,
etc) but today I'm very busy to do that.

Any contribution are welcome!

Regards Angelo

xdocr...@googlecode.com

unread,
Dec 12, 2013, 3:16:51 PM12/12/13
to xdocr...@googlegroups.com
Updates:
Status: Done

Comment #4 on issue 341 by angelo.z...@gmail.com: docx->xhtml, is there any
I close the issue.

rama

unread,
Dec 15, 2013, 6:21:36 AM12/15/13
to xdocr...@googlegroups.com, codesite...@google.com, xdocr...@googlecode.com
Hi Angelo,

In generated XHTML: i want to store images in memory and load images from memory. Is there any example for that?

Regards

Angelo zerr

unread,
Dec 15, 2013, 5:52:35 PM12/15/13
to xdocr...@googlegroups.com
Hi rama,

Not there is no sample about that. We have done that with our online demo http://xdocreport.opensagres.cloudbees.net/processReport.jsp when docx->xhtml converter is done.
If you use web support of XDocReport (dispatcher, servlet) you must do nothing. The images is retrieved from memory of the XDocArchive.

To store the XDocArchive, you must customize with init-paramter the param name of your servlet with cacheOriginalDocument  to true.

After that when image should be retrieved, XDocReport options converter is setted with an implementation of IURIResolver with WebURIResolver https://code.google.com/p/xdocreport/source/browse/document/fr.opensagres.xdocreport.document/src/main/java/fr/opensagres/xdocreport/document/web/AbstractProcessXDocReportServlet.java#562
which search from the original XDocArchive the images.

It works with original (template) docx, odt, buit not with the generated docx. So you could try to adapt this idea for your need (generated report).

Regards Angelo



2013/12/15 rama <inform...@gmail.com>

--
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.

Reply all
Reply to author
Forward
0 new messages