Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Jan 05, 2012 2:53 pm

Hi,

I was converting a document from docx to pdf and received the error:
"Index was out of range. Must be non-negative and less than the size of the collection."

I removed parts of the document to leave just the bits causing the error.
It seems the 2 tables and 2 field codes in the attached document cause the conversion error.

Hope you can help,

Thanks,

Mark.

markowens
 
Posts: 24
Joined: Mon Mar 14, 2011 3:20 pm

Fri Jan 06, 2012 2:44 am

Hi Mark,

Thank you for your inquiry.

We have tested the file you attached. It indeed throws an error as yours. But when we created a file as yours by MS Word, it works well. We also attached you the original file and the normal pdf file. Please have a look.
Would you please tell us how did you generate your docx file(by C# code? MS Word or Spire.Doc?)? It will help us better to resolve this issue you came up with.

Thanks in advance.

If you still have any other questions, please feel free to contact us.

Have a nice day.
User avatar

Suvi.Wu
 
Posts: 154
Joined: Thu Oct 20, 2011 2:53 am

Fri Jan 06, 2012 3:08 pm

Hi,

Thanks for your reply.

The document was created with Word (originally with Word2007 and then later amended with Word2010).

Copying the whole contents of the file and pasting it into a new Word document (in Word 2010) also seemed to cure the problem.

Thanks,

Mark.

markowens
 
Posts: 24
Joined: Mon Mar 14, 2011 3:20 pm

Return to Spire.Doc