Solved

Embedding data in a Word 2007 Docx file

Posted on 2009-04-01
2
452 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
Comment Utility
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
Comment Utility
Perfect.   This is exactly what I needed.  
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
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 walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.

771 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

12 Experts available now in Live!

Get 1:1 Help Now