wps的对poi合并的单元生成的word无效,
解决方法:
在服务器中生成word文件然后使用jacob插件重新保存一下在下载就可以解决
file = new File(filePath + fileName); //在服务器中保存的文件
// 重新保存文件
Object doc;
Variant f;
ActiveXComponent app = new ActiveXComponent("Word.Application");
try {
app.setProperty("Visible", new Variant(false));
Dispatch docs = app.getProperty("Documents").toDispatch();
doc = Dispatch.invoke(docs, "Open", 1, new Object[] { filePath + fileName, new Variant(false), new Variant(true) }, new int[3]).toDispatch();

针对WPS不支持POI合并单元格的问题,可以采用在服务器上使用Jacob插件重新保存Word文件的方法来解决。通过Java代码打开Word应用,打开文件,保存并关闭,再提供给用户下载,确保文件的兼容性。

4591

被折叠的 条评论
为什么被折叠?



