Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8179101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:55:41+00:00 2026-06-06T23:55:41+00:00

I have the following code: using (var doc = WordprocessingDocument.Open(filename, true)) { …. }

  • 0

I have the following code:

using (var doc = WordprocessingDocument.Open(filename, true))
{
    ....
}

Where string filename is a valid path to a docx file.

But calling Open causes the following InvalidOperationException: Specified part does not exist in the package.

Edit: I assume the problem is due to the docx file I’m trying to open being invalid so I’ll post the xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14">
    <w:body xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
        <w:p w:rsidRPr="005501CD" w:rsidR="00217D87" w:rsidP="005501CD" w:rsidRDefault="005501CD">
            <w:r>
                <w:t xml:space="preserve">Hello </w:t>
            </w:r>
            <w:r>
                <w:rPr>
                    <w:noProof />
                </w:rPr>
                <w:t>John</w:t>
            </w:r>
            <w:r>
                <w:t xml:space="preserve"> </w:t>
            </w:r>
            <w:r>
                <w:rPr>
                    <w:noProof />
                </w:rPr>
                <w:t>Smith</w:t>
            </w:r>
            <w:r>
                <w:t>,</w:t>
            </w:r>
            <w:bookmarkStart w:name="_GoBack" w:id="0" />
            <w:bookmarkEnd w:id="0" />
        </w:p>
        <w:sectPr w:rsidRPr="005501CD" w:rsidR="00217D87">
            <w:pgSz w:w="11906" w:h="16838" />
            <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="708" w:footer="708" w:gutter="0" />
            <w:cols w:space="708" />
            <w:docGrid w:linePitch="360" />
        </w:sectPr>
    </w:body>
</w:document>

Other docx files open fine, but I suspect a bug in my mail merge code is causing an invalid docx file to be generated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:55:42+00:00Added an answer on June 6, 2026 at 11:55 pm

    As it turns out the problem was due to a missing xml file. In case anyone else runs into similar problems, check the following:

    1. rename yourfile.docx to yourfile.zip
    2. extract the zip file and look in the file called [Content-Types].xml
    3. check that all the xml files listed in [Content-Types].xml exist in your zip file.

    In my case I had the following line in my [Content-Types].xml file:

    <Override PartName="/word/recipientData.xml" ContentType="application/vnd.ms-word.mailMergeRecipientData+xml"/>
    

    But I was missing the recipientData.xml file from the word directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: public void Dispose() { bool append = true; using(var
I have the following code. but it causes exception. using (var context = new
Suppose I have the following: using(var ctx = DataContextFactory.Create(0)) { ... Some code ...
I am using ASP.NET 3.5 with iTextSharp and I have the following code: var
I have the following code: using (BinaryReader br = new BinaryReader( File.Open(FILE_PATH, FileMode.Open, FileAccess.ReadWrite)))
I have the following code using jQuery Validate. $(#register).validate({ debug: true, errorClass:'error', validClass:'success', errorElement:'span',
I have the following code: class Program { static void Main(string[] args) { using
I have the following code: using (var db = new IntDB()) { var subscription
i have the following code using Nhibernate.Linq var apps = Session.Linq<History>().OrderByDescending(r => r.LastUpdated).Take(50); Console.Write(apps.Count());
I have the following code in my application: using (var database = new Database())

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.