Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

Hi,

When executing the following code

IWorkbook workbook = application.Workbooks.Open(excelStream);
Syncfusion.Pdf.PdfDocument pdf;
if (workbook.Charts.Count > 0)
{
    IChart chart = workbook.Charts[0];
chart.PageSetup.CenterHorizontally = true;
    chart.PageSetup.CenterVertically = true;
if (orientation == ContentOrientationType.Portrait)
        chart.PageSetup.Orientation = ExcelPageOrientation.Portrait;
    else if (orientation == ContentOrientationType.Landscape)
        chart.PageSetup.Orientation = ExcelPageOrientation.Landscape;
//Convert Excel document with charts into PDF document
    pdf = renderer.ConvertToPDF(chart);  //<-- exception thrown here}

At the marked line, it gives me NullReferenceException



Here's the stack trace


   at Syncfusion.XlsIO.Implementation.ConvertChartShapes.DrawShapesCollection(IShape[] shapes, Graphics graphics, Double scaleWidth, Double scaleHeight)
  at Syncfusion.XlsIO.Implementation.ConvertChartShapes.DrawShapesCollection(IShape[] shapes, Graphics graphics, Double scaleWidth, Double scaleHeight)
   at Syncfusion.XlsIO.Implementation.ConvertChartShapes.DrawShapesCollection(IShape[] shapes, Graphics graphics, Double scaleWidth, Double scaleHeight)
   at Syncfusion.XlsIO.Implementation.ConvertChartShapes.DrawChartShapes(Stream imageAsStream, Int32 width, Int32 height)
   at Syncfusion.XlsIORenderer.XlsIORenderer.ConvertToImage(IChart chart, Stream outputStream)
   at Syncfusion.XlsIO.Implementation.Charts.ChartImpl.SaveAsImage(Stream imageAsstream)
   at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawChart(IChart chart, PdfTemplate chartTemplate)
   at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawChartSheet(IChart chart, Int32 sheetsCount, LayoutOptions layoutOptions)
   at Syncfusion.XlsIORenderer.ExcelToPdfConverter.ConvertDocument()
   at Syncfusion.XlsIORenderer.ExcelToPdfConverter.Convert()
   at Syncfusion.XlsIORenderer.XlsIORenderer.ConvertToPDF(IChart chart)
   at GeODisy.Crosscuts.PdfHelper.OpenHtmlToPdfCreator.d__19.MoveNext() in C:\Users\Marco.Evangelisti\source\repos\Geodaisy\Application\Crosscuts\GeODisy.Crosscuts.PdfHelper\OpenHtmlToPdfCreator.cs:line 242

I'm attaching the Excel with the chart that's causing this error

Thank you for your help