?
Solved

Embedding data in a Word 2007 Docx file

Posted on 2009-04-01
2
Medium Priority
?
468 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
rseabird earned 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Suggested Courses

718 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