We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export Word document to PDF crashes if the document has chart with zero values

Hi,

We have a Word file containing some table and a couple of charts. We generate rows in table dynamically and update charts data points using a library called : OpenXmlPowerTools

If the chart data points are none zero everything is fine and we can export to Pdf using code like the below :

public static byte[] SaveToPdf(this Document templateDocument)
{
var pdfStream = new MemoryStream();
templateDocument.Save(pdfStream, SaveFormat.Pdf);
return pdfStream.ToArray();
}

If the chart data points are all zeros, the above crashes with index was outside the range of the array exception and a strange stack trace like the below. Attached file1.docx which works fine and file2.docx which has this problem (aspose version 15.10.0)




at .()
at .(Int32 )
at Aspose.Words.Drawing.Charts.ChartDataLabel.(ChartSeries )
at Aspose.Words.Drawing.Charts.ChartDataLabel.(ChartSeries )
at .( , ChartSeries , Int32 , )
at .( , ChartSeries , Int32 , RectangleF , PointF , PointF , Double , Double )
at .( , Int32 , ChartSeries , RectangleF , RectangleF , Single , Double , Double )
at .()
at . ( , )
at .( , )
at .( )
at .()
at .()
at .()
at .(ShapeBase , )
at . ( )
at ​ .(ShapeBase )
at ​ .(ShapeBase , )
at .(ShapeBase , ​ )
at .(​ , Boolean )
at .( )
at .( )
at .(​ )
at . ()
at .( , ArrayList , ArrayList )
at .( , ArrayList , ArrayList )
at .( , ArrayList , ArrayList )
at .()
at . ( )
at .( )
at .( , )
at .( , )
at . ( )
at Aspose.Words.Document.( , SaveOptions )
at Aspose.Words.Document.(Stream , String , SaveOptions )
at Aspose.Words.Document.Save(Stream stream, SaveOptions saveOptions)
at Aspose.Words.Document.Save(Stream stream, SaveFormat saveFormat)
at Web.ApplicationServices.WordDocumentExtensions.SaveToPdf(Document templateDocument) in D:\Work\BlueSky\InvestorApp\Repo\InvestorPlatform\Api\Api\Extensions\WordDocumentExtensions.cs:line 146
at Web.ApplicationServices.PortfolioSummaryDocumentService.d__4.MoveNext() in D:\Work\BlueSky\InvestorApp\Repo\InvestorPlatform\Api\Api\ApplicationServices\PortfolioSummaryDocumentService.cs:line 51
Hi Yousry,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 16.1.0 and have not found the shared issue. We have attached the output documents with this post for your kind reference.

We would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. Hope, this helps.

Download latest version of Aspose,Words for .NET