locked
Generating a .docx file - getting an error I can't understand RRS feed

  • Question

  • Short version: I try to open up a .docx file in Word, and get the error that it "cannot be opened because there are problems with the contents." The only details offered are "Microsoft Office cannot open this ile because some parts are missing or invalid." My question is, which parts? I need to know! How can I find out?

    Long version:So my task is to put together a Perl script that will generate a .docx file, and I am using the Perl Template Toolkit module.

    I'm just getting started with all this, and here's what I've done so far - I created a sample one-page file in Word 2007, and unzipped it. I grabbed the document.xml file out of the word folder, modified it to serve as a test template (this entailed replacing a couple lines of text with [% ProjName %] and [% DocName %], and wrote up my script to replace those bits with a project name and a document name. The script, having done this, spits out a document.xml file (which, aside from the new text, looks just like the old one I used to create the template), which I then use to replace the one in the .docx file I unzipped. Zip it back up, rename it to something.docx, and try to open it in Word.

    Word gives me the annoyingly vague error detailed in "short version" above. I really need to know what the problem is so I canfix it!

    So, can anyone help me find oiut what is causing the problem, or tell me where a better place to re-post this question, I would be most appreciative!

    Thank you!
    Kaiti
    Thursday, March 11, 2010 7:54 PM

Answers

  • Looks like your document generation has bugs, try the OOXML forum.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    • Marked as answer by Kaiti Tuesday, April 27, 2010 9:52 PM
    Thursday, March 11, 2010 11:24 PM

All replies

  • Looks like your document generation has bugs, try the OOXML forum.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    • Marked as answer by Kaiti Tuesday, April 27, 2010 9:52 PM
    Thursday, March 11, 2010 11:24 PM
  • Thank you, I will!
    Thursday, March 11, 2010 11:40 PM