How do I load a Microsoft word document or any type of document into a java program and be able to replace words and manipulate the document using Java?
How do I load a Microsoft word document or any type of document into a java program?
Jon the following Java forum %26amp; feel free from all errors........
http://forum.java.sun.com/index.jspa
http://forums.java.net/jive/index.jspa
Reply:First of all forget that this is a Microsoft word document.
As far as your program is concerned it is just a file.
So just read the file and search for the text that you want to change. As long as Microsoft Word has not broken up the text then this should work.
Reply:The simple answer is that you load it just like you would any other file. However, MS Word files are not text (ASCII or UTF) files, they are binary. So if you load it into a string, it will be meaningless. You need to convert the "Word" binary data into a structure (object) in memory in which one property will be the text.
Look around for a Java MS converter. But keep in mind a Word doc contains TONS of other information that you may or may not be interested in.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment