How to add page numbers in a Document from Java?
Showing comments 1 to 5 of total 5 on page 1 of 1
How can i add page number to a word document from Java? Can i do this without using any third party libraries?
Not without any third party libraries. There's no built-in handling for Word documents.
You might be able to do something with Word 2007 documents which are basically zip files of XML files, but you'd still need to understand the format in a fair amount of detail. It would be a lot simpler to use a third party library rather than reinventing the wheel.
Apache POI, Third party library.
Not without a third part library.
POI is all I've ever used. Only made any use of the Excel portions, but they worked fairly well.
If you just need minor things you could implement the RTF file format yourself.
This is probably well out of your scope but I'll mention it anyway in case it helps someone else.
Aspose.Words will do what you want, but it is commercial, and is quite expensive.