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

Free Support Forum - aspose.com

Excel 2003 Pie Chart lables locations are not preserved when rendering to image

Hello,

We have a problem regarding the convertion of Excel 2003 Pie Charts to Image. The pie chart lables are not rendered correctly. Here is the code to reproduce the issue:

var workbook = new Workbook(@“PieChart2D.xls”);<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

var chart = workbook.Worksheets[0].Charts[0];<o:p></o:p>

var chartImage = chart.ToImage(new
ImageOrPrintOptions<o:p></o:p>

{<o:p></o:p>

Quality = 100,<o:p></o:p>

VerticalResolution =
200,<o:p></o:p>

HorizontalResolution
= 200,<o:p></o:p>

PrintingPage = PrintingPageType.IgnoreBlank,<o:p></o:p>

ImageFormat = ImageFormat.Png,<o:p></o:p>


OnePagePerSheet = true<o:p></o:p>

});<o:p></o:p>

chartImage.Save(“Image_PieChart_2D.png”);<o:p></o:p>

Thank You,

Tudor Bancila,

IBM Romania

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to replicate this issue using the latest version:
Aspose.Cells
for .NET v7.3.1.2



We have logged this issue in our database. We will look into it and fix the issue.

Once the issue is resolved or we have some other update for you, we will share it with you asap.

This issue has been logged as CELLSNET-41035.

Below is a sample test code. I have attached the output image for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\PieChart2D.xls”;


var workbook = new Workbook(filePath);


var chart = workbook.Worksheets[0].Charts[0];


var chartImage = chart.ToImage(new ImageOrPrintOptions

{

Quality = 100,

VerticalResolution = 200,

HorizontalResolution = 200,

PrintingPage = PrintingPageType.IgnoreBlank,

ImageFormat = ImageFormat.Png,

OnePagePerSheet = true

});


chartImage.Save(filePath + “.out.png”);

Hi,

Thanks for using Aspose.Cells.

We have looked into your issue, we found that if you open the source file with Excel 2007 or higher version, you will find that our target .xls is same as Excel 2003 and the result of .xlsx is same as Excel 2007.

Please refer the attachment that looks same as the generated image.

If you want it look like in Excel 2007, please add the code

“book.FileFormat = FileFormatType.Xlsx; “ before calling chart.ToImage() method.

Actually, when the position of data label is set to Best Fit, we cannot make the result be perfect like the excel as that is too complex.

Hi,

We tried the fix you suggested above for other charts also.
For the file I attached here, setting the file format for Excel 2007 modifies the position of the vertical axis label; also the values from the vertical axis are different and the bottom axis labels are missing. The legend above the chart is slightly repositioned, the same also for the chart title.

Please see the difference in the attached images between the correct chart (“Test with xls format.png”) and the chart obtained with your suggestion (“Test with xlsx format.png”).

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to observe this issue. The problems exist in both charts which are output in xls and xlsx format. We have logged this issue in our database. We will look into it and resolve this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41934.