Chart Image created using aspose.cells, is different from its chart object in excel sheet?

Hi,

We have been using aspose.cells for quiet a long time and didn’t had any major issues, But recently we have an issue in our production, while converting a chart object in excel to an bitmap image.

Luckily, we are able to replicate this issue in a sample project and attached the same here with.

Please find the attached zip file(AsposeSupport_ChartIssue_V1.zip (71.0 KB)) and the sample project named “Chart_Issue_v1” and the sample excel file named “Sample Chart Issue file.xlsx”. inside the zip file.

The issue is when we convert the chart object from excel file, the converted image is not same as the chart in excel sheet. It’s legends are re-aligned and overlapping on the chart image. . You can see this behavior when you run the sample project.

I am guessing, during conversion aspose.cells is increasing the width/height of the chart object somehow, making the converted image to look different. You can notice the same, If you just increase the width of the “chart” in excel file, you can see how the image is getting modified and legends are getting horizontally aligned and overalaping on the chart object.

This is already in our production, so please look into this issue and provide a solution as soon as possible.

Please let us know, if you need anything.

Note:

  1. You need to modify the “excelFilePath”, “outputImageForTesting” and “asposeLicensePath” variables in the sample project as per your need, before you run the project.
  2. I have removed the aspose.cells.dll from the attachment as it is heavy in size, you need to add it manually on your end.

Regards,
Prathap

@PrathapSV,

Thanks for the template file and sample project.

Please note such issues cannot be tackled easily, so you have to extend/customize especially the height of the chart a bit to accommodate all the legend entries to prevent overlapping issue. See the sample code segment (see the added line of code for your reference):
e.g
Sample code:

......
ApplyWorkSheetSettings(sourceWorksheet);
            ImageOrPrintOptions imageOrPrintOptions = GetImageOrPrintOptionsSettings();
            Aspose.Cells.Charts.Chart sourceChart = sourceWorksheet.Charts[chartNameInExcel];            
            
            //Set the height of the chart
            sourceChart.ChartObject.Height = 300;
            sourceChart.Calculate();
.........

For

This is not an issue with Aspose.Cells APIs. Please take the print preview of the chart only (select the chart and open PageSetup|Print Preview) in MS Excel manually and you will notice such a display as well, see the screenshot for your reference:
sc_shot1.png (66.3 KB)

It’s not at all possible to accept your solution.

Please note that, the chart is generated for a number of customers with a number of sheets, where the chart types or chart height will be different every time. We cannot customize the height of the chart in anyway, as it won’t be the same every time for all the customers and more over a customer will not import only one type of chart all the time.

Basically, it’s not at all possible to predict/calcuate the “exact height of the chart object which needs to be set” everytime, as each time chart object will be different.

Please understand the dynamic behavior of the application and provide a proper solution ASAP.

Regarding the legends getting re-aligning horizontally(which you said it’s because of Microsoft Excel), We are fine if it re-aligns horizontally, but it shouldn’t overlap on the chart which is happening in our case only but not when we print the chart object with MS excel print preview.

I have taken a print of the chart object using MS Excel’s print preview(attached here: printed chart object.pdf (229.6 KB) ), which looks pretty much fine, even though it re-aligns the legends horizontally, it will not overlap on the chart. . At least if we get the image and legends similar to this, it should be fine for us.

Regards,
Prathap

@PrathapSV,

Thanks for pointing it out.

As we already reproduce the issue as you described. so we have logged a ticket with an id “CELLSNET-47200” for your issue. The issue is logged as following:
CELLSNET-47202 - Legend entries are overlapped in the output image of chart

We will look into it soon.

Once we have an update on it, we will let you know.

@PrathapSV,

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47202”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@PrathapSV

Please try our latest version/fix: Aspose.Cells for .NET v20.2.4 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.2.4 For .Net2_AuthenticodeSigned.Zip (5.2 MB)
Aspose.Cells20.2.4 For .Net4.0.Zip (5.2 MB)
Aspose.Cells20.2.4 For .NetStandard20.Zip (4.4 MB)

Thank you, will let you know if we find any issues after testing.

@PrathapSV,

Please take your time to evaluate the new fix/version. Hopefully it will fix your issue.

The issues you have found earlier (filed as CELLSNET-47202) have been fixed in Aspose.Cells for .NET v20.3. This message was posted using Bugs notification tool by Amjad_Sahi