MohamedSaeed / xdocreport

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

docx->xhtml, is there any good way to locate the image? #341

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by yynora...@gmail.com on 12 Dec 2013 at 12:10

GoogleCodeExporter commented 9 years ago
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

Original comment by angelo.z...@gmail.com on 12 Dec 2013 at 1:46

GoogleCodeExporter commented 9 years ago
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

Original comment by yynora...@gmail.com on 12 Dec 2013 at 7:24

GoogleCodeExporter commented 9 years ago
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

Original comment by angelo.z...@gmail.com on 12 Dec 2013 at 8:15

GoogleCodeExporter commented 9 years ago
I close the issue.

Original comment by angelo.z...@gmail.com on 12 Dec 2013 at 8:16

GoogleCodeExporter commented 9 years ago
cleanup

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