Page 1 of 1

How to convert a page or few pages into XHTML files?

PostPosted: Fri Sep 05, 2014 12:33 pm
by minhld
Hello,
I saw a lot of examples converting the whole DOCX file into a single XHTML file but still don't know how to convert only a few selected pages into 1 or XHTML files (1 page -> 1 XHTML file).
If it is possible, could you give an example? Thank you.

Re: How to convert a page or few pages into XHTML files?

PostPosted: Fri Sep 05, 2014 3:07 pm
by jason
There is no notion of a page in docx4j, since we don't currently have a page layout model (except for that used in the Enterprise ed for TOC generation).

You can try relying on the lastRenderedPageBreak element which Word inserts.

Or you could potentially put the content you want to convert into a content control, then convert that. The easiest way would be to programmatically delete the rest of the docx, then convert what remains.

Re: How to convert a page or few pages into XHTML files?

PostPosted: Fri Sep 05, 2014 3:09 pm
by jason
Alternatively, you could consider chunking on headings. I did that to create the HTML pages you see at webapp.docx4java.org/OnlineDemo/ecma376/WordML/index.html

Re: How to convert a page or few pages into XHTML files?

PostPosted: Fri Sep 05, 2014 5:19 pm
by minhld
Thank you for the answers
I'm now trying the solution you suggested, searching for lastRenderedPageBreak but it looks complicated for me :(
If failed, I think DOCX -> PDF -> XHTMLs is the solution, although data missing problem would be more serious.