Page 1 of 1

Insert content on specified page

PostPosted: Tue Aug 17, 2010 12:11 am
by heitorflorido
Hello,

I'd like to know if there is any way of inserting some random content at the begining of the second page of an existing docx file?

Thanks

Heitor Florido

Re: Insert content on specified page

PostPosted: Wed Aug 18, 2010 1:48 am
by jason
In general (unless docx4j were to implement Word's undocumented page layout algorithm), there is no way to no where the second "page" starts.

If however. your document contained a manual page break XML element, you could locate this, and insert your content after it. Similarly, you knew what content was already on the "second" page.

Its prob worth mentioning here that there are 2 ways to find a specific bit of content. One is iterating through/ traversing the document content. The other is via XPath. See the Getting Started guide on this.

Re: Insert content on specified page

PostPosted: Wed Aug 18, 2010 11:14 am
by heitorflorido
I'm already iterating through the content.

I just wanted to know if there was a "better" way to do it.

Thanks anyway.