Page 1 of 1

Replace Html Content & Image with Bookmark Value

PostPosted: Tue Sep 16, 2014 10:04 pm
by vishal.nariya
Hello,

I am using Docx4j for my document management system. I have word template having some bookmark available on it. I am able to replace bookmark value
with Noraml Text but i need to replace BookMark value with HTML Text and Images.

I am able to place html content and images directly on word template but not able to replace it as bookmark value. I need to use it because want to read it again later time.

Thanks in advance.

Regards,
Vishal Nariya

Re: Replace Html Content & Image with Bookmark Value

PostPosted: Tue Sep 16, 2014 11:51 pm
by jason
Which part of the problem are you having problems with?

Are you using docx4j-ImportXHTML to convert your html content to docx content?

If so, is your problem placing that docx content into your bookmark?

For further assistance, you'll need to attach sample input xhtml, your code, and the docx containing your bookmark

Re: Replace Html Content & Image with Bookmark Value

PostPosted: Wed Sep 17, 2014 9:22 pm
by vishal.nariya
Hello Jason,

Thanks for your quick reply.

My problem is to placing that html content (altchunk) into bookmark (Available inside Microsoft Document i.e template.docx). Attached is my eclipse project.

Inside Invitation.java i am using replaceParagraph method. When i am using textToAdd value as normal text then its working fine but when i am using value as normal HTML its not working.

Why I require it because i want read it again with getBookmarkContents methods in Invitation.java file. My Microsoft Word template will be in Arabic/English language.


Regards,
Vishal

Re: Replace Html Content & Image with Bookmark Value

PostPosted: Wed Sep 17, 2014 10:54 pm
by jason
I haven't unzipped your project, but if your bookmarks are inline (ie not paragraph siblings), then I guess you are trying to put an altChunk inside a paragraph. If I recall correctly, this won't work since an altChunk has to be block level (ie paragraph sibling). You should check this - I'm just going by my recollection. Most people who use docx4j use its ImportXHTML functionality, not the HTML altChunk stuff since that requires Word to convert it to 'real' content.