Hi All,
I am processing a template document using docx4j and I want to get the currently editing page number. Is there any API to get the current page number? Any tip of this will be appreciated. Thanks.
It is currently Sat Nov 22, 2025 8:55 pm
News of docx4jimport java.io.File;
import java.util.List;
import org.docx4j.model.structure.SectionWrapper;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
public void runTest() {
try {
File file = new File("c:\\temp\\word1.docx");
File file2 = new File("c:\\temp\\word2.docx");
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(file);
List<SectionWrapper> sections = wordMLPackage.getDocumentModel().getSections();
wordMLPackage.save(file2);
} catch(Exception e) {e.printStackTrace()};
}
Total posts 10211 • Total topics 2876 • Total members 2103