Solved

Embedding data in a Word 2007 Docx file

Posted on 2009-04-01
2
458 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.

816 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now