一、java web 打开word
好了,我们要用到的就是微软的dsoframer控件,它是免费的,比第1个方案,功能稍强,这个控件没有详细研究,看了看别人的demo,感觉功能不强就没研究下去,附件中也有相关代码的,大家直接参考下好了.第3个方案,另辟蹊径既然微软这棵大树我们靠不住,就只能借助于第三方控件了,老外在这方向做得很牛X,方方面面的控件或插件都有,只有想不到,没有找不到…唉,中国啊…这个控件是OfficeOCXSetup插件,当前版本是7.4.0.236,附件有此安装程序,安装完以后有各编程工具的示例,安装程序提供的示例只提供了简单的打开,关闭,保存等操作。
.。
二、纯java怎么实现网页在线显示office文档
可以用第三方服务接口实现,但安全性要好,文档不能泄露出去poi里有个ExcelToHtmlConverter 和 WordToHtmlConverter这是在网上找的一段代码我没试 HWPFDocumentCore wordDocument = WordToHtmlUtils.loadDoc(new FileInputStream("D:\\temp\\seo\\1.doc")); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument()); wordToHtmlConverter.processDocument(wordDocument); Document htmlDocument = wordToHtmlConverter.getDocument(); ByteArrayOutputStream out = new ByteArrayOutputStream(); DOMSource domSource = new DOMSource(htmlDocument); StreamResult streamResult = new StreamResult(out); TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty(OutputKeys.METHOD, "html"); serializer.transform(domSource, streamResult); out.close(); String result = new String(out.toByteArray()); System.out.println(result);。
三、纯java怎么实现网页在线显示office文档
可以用第三方服务接口实现,但安全性要好,文档不能泄露出去
poi里有个ExcelToHtmlConverter 和 WordToHtmlConverter
这是在网上找的一段代码我没试
HWPFDocumentCore wordDocument = WordToHtmlUtils.loadDoc(new FileInputStream("D:\\temp\\seo\\1.doc"));
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(
DocumentBuilderFactory.newInstance().newDocumentBuilder()
.newDocument());
wordToHtmlConverter.processDocument(wordDocument);
Document htmlDocument = wordToHtmlConverter.getDocument();
ByteArrayOutputStream out = new ByteArrayOutputStream();
DOMSource domSource = new DOMSource(htmlDocument);
StreamResult streamResult = new StreamResult(out);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
serializer.setOutputProperty(OutputKeys.METHOD, "html");
serializer.transform(domSource, streamResult);
out.close();
String result = new String(out.toByteArray());
System.out.println(result);
四、java web 打开word
好了,我们要用到的就是微软的dsoframer控件,它是免费的,比第1个方案,功能稍强,这个控件没有详细研究,看了看别人的demo,感觉功能不强就没研究下去,附件中也有相关代码的,大家直接参考下好了.
第3个方案,另辟蹊径
既然微软这棵大树我们靠不住,就只能借助于第三方控件了,老外在这方向做得很牛X,方方面面的控件或插件都有,只有想不到,没有找不到…唉,中国啊…
这个控件是OfficeOCXSetup插件,当前版本是7.4.0.236,附件有此安装程序,安装完以后有各编程工具的示例,安装程序提供的示例只提供了简单的打开,关闭,保存等操作.