Solved

Embedding data in a Word 2007 Docx file

Posted on 2009-04-01
2
459 Views
Last Modified: 2012-06-27
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
Comment
Question by:srulison
2 Comments
 
LVL 8

Accepted Solution

by:
rseabird earned 250 total points
ID: 24039358
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
 

Author Closing Comment

by:srulison
ID: 31565307
Perfect.   This is exactly what I needed.  
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question