This project has moved. For the latest updates, please go here.

Problem opening docx file containing jpeg?

Jun 29, 2010 at 3:38 PM

Should I be able to open a docx file containing a jpeg? If I try I get a NullReferenceException "Object reference not set to an instance of an object."

Any ideas? I've just tried this with a brand new docx and jpeg straight from the internet (I used you doc x logo converted to jpeg in mspaint) and it's failing?

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Novacode;

namespace DocxLearning
{
    class Program
    {
        static void Main(string[] args)
        {
            using (DocX doc = DocX.Load("testpic.docx"))
            {

            } 
        }
    }
}

Jun 29, 2010 at 3:40 PM

I've just tried a different docx with many jpegs in and get an InvalidOperationException "Sequence contains more than one element". Same code as above.

Any ideas?

Coordinator
Jun 30, 2010 at 10:46 AM
mark_stevo,

I am not able to reproduce the issue on my side. Can you please send me a docx file that causes this error? I will test it with your code and try to find the problem.

kind regards,
Cathal