开发者

how to add content of word doc file in jsp file using include action?

I am trying to i开发者_JAVA技巧nclude the text content of microsoft word file in my jsp file.... I am not able to figure out the solution.


You'll need to use Apache POI to parse the text out of the MS Word Document.


It is not possible to include proprietary/platform-specific formats in a HTML page without a good plugin in the webbrowser. Besides, in case of MS Office documents you're heavily dependent on the client machine whether it would work or not. Not every Windows machine has MS Office installed and even then not every of them has a browser plugin for that. This ain't going to work in non-Windows machines.

So you have basically two options:

  1. Programmatically extract the Word document yourself and display contents as HTML.
  2. Convert the Word document to a more standard format supported by a majority, like PDF.

If you prefer 1, you could use the aforementioned (and memory hogging) Apache POI for that. Or you could use the more memory efficient (and OOo based) JODConverter for that. It can even convert Word documents to HTML or even to PDF so that you've a solution for option 2 as well. In this case you can just use <iframe> or <object> tags to display the PDF embedded in HTML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜