Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

Embedding data in a Word 2007 Docx file

Can somebody tell me if it is possible to embed a special XML file or
for that matter, any file into a Word 2007 Docx zip file structure?  I
would like to be able to store some data elements in the Word docx
file, that is not viewable when the document is opened in Word but can
be read by a java program at a later time.  I have tried adding files
of various types in the structure but Word always chocks on it when I
try to open the file.

Thanks.

Steve.
0
srulison
Asked:
srulison
1 Solution
 
rseabirdCommented:
You may know that docx is actually a zip format.
1. Rename your document extension .docx to .zip
2. Extract the zip file to a temp folder
3. If it doen't exists, create a folder customXml straight under the temp folder (you'll see also folders like _rels, docProps and Word).
4. Put your xml file into this customXML folder
5. Place the extracted files back into a zip file. Beware that you don't zip the temp folder, but the only the content inside the temp folder.
6. Rename the zip file back to docx and you're done.
0
 
srulisonAuthor Commented:
Perfect.   This is exactly what I needed.  
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now