Convert Word DOC with Charts without X-Axis Series Data to PDF using C# .NET and Avoid System Argument Out Of Range Exception


We’ve got an exception when we try to convert the Word File into a PDF File (function doc.Save) :
Index was out of range. Must be non-negative and less than the size of the collection parameter name:index

at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Aspose.Words.Drawing.Charts.ChartSeries

Is there a bug ? Or due to a corrupt file ?

Document (769.9 KB)


You are right; the following simple C# code of Aspose.Words for .NET 20.9 API throws System.ArgumentOutOfRangeException upon DOCX to PDF conversion.

Document doc = new Document("C:\\Document Word\\Document Word.docx");
doc.Save("C:\\Document Word\\20.9.pdf");

We have logged this problem in our issue tracking system with ID WORDSNET-21083. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-21083) have been fixed in this Aspose.Words for .NET 20.10 update and this Aspose.Words for Java 20.10 update.