I am writing a python script that does some data analysis and writes the
result to a OOXML (.docx) file. For a reference, I would like to include
the script into the docx file itself, so that a reader could re-extract
the script if needed.
Is there a good way to do that?
From playing with the Word97 menus, I found only two ways:
- include as an "Object": that requires to wrap the python script into
something unknown (the "object"?), and to link it to an "application"
to view it.
- directly include the script text in the word file. This makes the
script directly visible in the docx file (which is bad) and it is not
trivial to save the script to its own file.
I also tried just to put the file into the "media" subdirectory (like
images) and to assign the mime type "text/x-python" or "text/plain" to
it. However, WOrd refuses to open such files, and I also dont know how I
should refer to them in the document.xml text.
How can I solve the problem?
Ole