This project has moved and is read-only. For the latest updates, please go here.

Cannot Load a document that already contains an image

Jul 26, 2011 at 4:35 PM

I am trying to work with a document that already contains headers, footers, and several images. My goal is to update a Call List and employee listings within the document using LINQ to SQL to pull data from the Employees table and insert it into the document. However, when i load the document, it fails at the load with "Object reference not set to an instance of an object". If i remove the images, it loads and updates the test document. I am using the latest .Net 3.5 version as the server this will be deployed to does not support .Net 4.0 at the moment. The load statement it fails at is shown below. If you provide me an email address, i will send you a copy of my test document.

Thank you!

static void Main(string[] args)
            EmployeesDataContext dc = new EmployeesDataContext();
            using (DocX document = DocX.Load(@"C:\Temp\BCPTestDocument.docx"))