下面的代码示例演示如何使用Java合并MS Word文档。
// Load Word documents to be merged
Document doc1 = new Document("sample1.docx");
Document doc2 = new Document("sample4.docx");
下面的代码示例演示如何使用Java将两个MS Word文档与其他选项合并。
// Load Word documents to be merged
Document doc1 = new Document("sample1.docx");
Document doc2 = new Document("sample4.docx");
// Set options
ImportFormatOptions options = new ImportFormatOptions();
options.setIgnoreHeaderFooter(true);
//options.setIgnoreTextBoxes(true);
//options.setKeepSourceNumbering(true);
//options.setSmartStyleBehavior(true);