使用 apache poi 创建的 word 文档始终以兼容模式打开
Created word document using apache poi always open in compatibility mode
我正在尝试使用 XWPF (POI-OOXML 3.16) 创建 word 文档。创建的word文件在使用MS word 2016时以兼容模式打开。有什么解决办法吗?
我不希望它出现在兼容模式下。
这是简单的代码:
public static void main(String[] args) throws InvalidFormatException {
XWPFDocument document = new XWPFDocument();
try {
File file = new File("path.docx");
FileOutputStream out = new FileOutputStream(file);
document.write(out);
out.flush();
out.close();
document.close();
} catch (IOException e) {
e.printStackTrace();
}
}
即使我没有在文档中写入任何内容,创建的文档 (path.docx) 也会以兼容模式打开。我在 macbook pro 上使用 MS WORD 2016。
我通过使用 word 创建一个空的 docx 文件解决了这个问题,然后使用它从软件进行修改
我正在尝试使用 XWPF (POI-OOXML 3.16) 创建 word 文档。创建的word文件在使用MS word 2016时以兼容模式打开。有什么解决办法吗? 我不希望它出现在兼容模式下。
这是简单的代码:
public static void main(String[] args) throws InvalidFormatException {
XWPFDocument document = new XWPFDocument();
try {
File file = new File("path.docx");
FileOutputStream out = new FileOutputStream(file);
document.write(out);
out.flush();
out.close();
document.close();
} catch (IOException e) {
e.printStackTrace();
}
}
即使我没有在文档中写入任何内容,创建的文档 (path.docx) 也会以兼容模式打开。我在 macbook pro 上使用 MS WORD 2016。
我通过使用 word 创建一个空的 docx 文件解决了这个问题,然后使用它从软件进行修改