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

Free Support Forum - aspose.com

Chart's legend resized and displayed differently when loading an .xls file with Aspose

Hello,

We’ve encountered an issue when opening an .xls file containing a chart. It seems after opening and saving back to .xls the document with Aspose, the chart’s legend is resized and displays differently than in the original file. When doing the same but saving to .xlsx this doesn’t happen.

I’ve attached a small console application describing this - the chart’s legend is the one on top of the chart, the application just loads the test input file and saves the file to .xls and .xlsx.

We are using Aspose.Cells version 8.0.2.0.

Any feedback will be highly appreciated.

Thank you,
Mihai Andrei
Senior Software Engineer
IBM Romania

Hi Mihai,


Thank you for providing your sample project.

We are able to replicate the presented scenario on our end while using the latest version of Aspose.Cells for .NET 8.1.0.1. We have noticed that after loading and saving back your provided spreadsheet with Aspose.Cells API, the chart legend entries have been re-arranged. We have logged an investigative ticket (CELLSNET-42755) in our bug tracking system to analyze this scenario, and to check if we can improve this behavior. We will keep you posted with updates in this regard.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.1.2.5 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-42755) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

It seems to me the problem isn’t fixed. I run into issue in 7.7.1.0 and 8.2.0.0

Look at my attachments please. I created two simple identical templates - XLS and XLSX with charts. And i wrote two simple C# + Aspose.Cells programs which just open and close the files.

After XLS open-sace chart legend loses its position and becomes Undocked. Also it loses its ability to accomodate its size to chart size. There is all fine with XLSX template.

Hi,

Thanks for your posting and using Aspose.Cells.

Please provide us your input.xls file so that we could investigate this issue at our end and log it in our database if the problem exists or cannot be resolved with some workaround.

Here is.

Hi,

Thanks for your sample file and using Aspose.Cells.

We were able to observe this issue after executing the following code using the latest version: Aspose.Cells for .NET 8.2.0.

The chart legend position is not selected for XLS format but it is selected fine for XLSX format.

We have logged this issue in our database for investigation. We will look into it and fix 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-42945.

I have also attached the output xls and xlsx files for a reference.

C#


Workbook workbook = new Workbook(“input.xls”);


workbook.Worksheets[“Sheet”].Cells[“B1”].PutValue(“Sample Text”);


//The chart legend position is not selected for XLS format but it is selected fine for XLSX format.

workbook.Worksheets[“Chart”].Charts[0].Legend.Position = LegendPositionType.Right;


workbook.Save(“output.xls”, SaveFormat.Excel97To2003);

workbook.Save(“output.xlsx”, SaveFormat.Xlsx);

Hi Mihai,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.2.2.2 and let us know your feedback.

We have added SetPositionAuto() method for plot area. As the input.xls file indicate the position of plot area is customized according to the data we read from input.xls, we will save the position information to the output file.

So the plot area will change with the legend. For solving the issues, we provide a method that set the position of plot area to automatic.

C#


Chart c = workbook.Worksheets[“Chart”].Charts[0];

c.Legend.Position = LegendPositionType.Right;

c.PlotArea.SetPositionAuto();


Hi Shakeel,

Is this issue also fixed in Aspose.cells for java? If so, what would the example code snippet be? Thank you.

Hi Mihai,

Thanks for your posting and using Aspose.Cells.

Yes, the fix is also available in Java. Please download and use the latest java fix: Aspose.Cells
for Java v8.2.2.2
.

And .NET version is ported to Java version, therefore the code snippet is also same. Please see the following code snippet for Java.

Java


Chart c = workbook.getWorksheets().get(“Chart”).getCharts().get(0);

c.getLegend().setPosition(LegendPositionType.RIGHT);

c.getPlotArea().setPositionAuto();

The issues you have found earlier (filed as CELLSNET-42945) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.