I am converting HTML Document into word document using Docx4j jar. finally i got the word document but i could not change the default properties. I have facing the following problems in Docx4j jar
How to set the custom page size of document using Docx4j properties other than default page size A4,A3, B4JIS?
The constructor
XHTMLImporterImpl(WordprocessingMLPackage wordMLPackage)
specifies the docx into which your content will be imported. (I assume you're doing it that way; if you are using altChunk, what follows would still apply, unless Word adds a sectPr!)
It takes on the page size defined in that docx.
Page size is defined in the sectPr element, so more precisely, it takes on the page size of the applicable sectPr.
So, you can either change that, or add a new sectPr. Note: since a sectPr applies to the content before it, you should add a sectPr with the existing sectPr properties (or move the existing one), then your content, then a sectPr with the page size you want.
To generate relevant code, use the docx4j code generation tool, available via the docx4j webapp, or the code gen Word AddIn.