• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.doc files

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im trying to insert text into a template .doc file, and you can treat word
files as just plain text.

but I was talking to my professor and he said he thought that java had packages that could deal with .doc files, but not .docx files which is 2007 encryption i guess.

can anyone elaborate on this anymore, like for instance the actual package to look for.

Justin
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java does not have classes that can deal with .doc or .docx files. Some limited access is possible through the Jakarta POI library, but inserting text may already be beyond it.

I understand that .docx is an XML format (albeit an undocumented one, unless you count a 6000 page document as 'documentation'), so Java code could access those through the JAXP API. I doubt that that does you any good unless you have mastered the 6000 pages, though.
 
Tony VanHorn
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any of the 2007 office components are using XML format, hence the .docx. They have done this so that you can take advantage of a feature that allows you to hover over formatting changes and see what the document will look like without having to actually select the change and then hit undo or choose a different one. You should be able to unzip the .docx file into its different parts, which include the XML for the main content.
 
Jeff Ash
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might look at the Apache Jakarta project called POI. It's free and open-source. It allows you to interact with various Microsoft OLE documents such as Word and Excel. I have played with it a little, but not enough to give you any guidance. You can find it at:
http://jakarta.apache.org/poi/index.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic