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

Free Support Forum - aspose.com

Pie charts - aspose.cells renders empty category while Excel doesn't

To test please use the following program and the attached spreadsheet.

When you open the spreadsheet in Excel you’ll notice that Slice 4 is not included in the pie chart.

If you run the program below and open the png file you’ll see that aspose rendered the label for Slice 4 even though its value was set to #N/A (it is not 0).

How can I make aspose to hide the categories that have an #N/A value?

C# program that converts the chart to a png image.

private static void TestPieCharts()
{
string path = @“C:\temp\spreadsheets”;
Workbook workbook = new Workbook(path + “test_pie01.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];

foreach (Shape shape in worksheet.Shapes)
{
if (shape.IsGroup)
continue;
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageFormat = ImageFormat.Png;
string fileName = String.Format("{0}.png", Guid.NewGuid());
shape.ToImage(path + fileName, options);

Cell originalTopLeftCell = worksheet.Cells[shape.UpperLeftRow, shape.UpperLeftColumn];
Console.WriteLine(“Cell {0} , shape {1}, top {2}, left {3}, topInShape: {4}, group: {5}”, originalTopLeftCell.Name, shape.Name, shape.Top, shape.Left, shape.TopInShape, shape.Group == null ? “” : shape.Group.Name);
if (worksheet.Cells.IsColumnHidden(originalTopLeftCell.Column) || worksheet.Cells.IsRowHidden(originalTopLeftCell.Row))
{
Console.WriteLine(“Cell is hidden”);
}
}

}

I used Aspose 8.0.0, VS2010 and C# 4.0 to test.

Thanks



Hi Costa,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue using the latest version: Aspose.Cells for .NET 8.0.1 with the following sample code which converts the pie chart into image. Aspose.Cells rendered the label for Slice 4 even though its value was set to #N/A (it is not 0), this is not same as MS-Excel.

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-42574.

I have attached the output image which also highlights the issue for a reference.

C#


Workbook workbook = new Workbook(path);


Worksheet worksheet = workbook.Worksheets[0];


Chart ch = worksheet.Charts[0];


Bitmap bmpChart = ch.ToImage();

bmpChart.Save(path + “.out.png”, ImageFormat.Png);

Hi Costa,

Thanks for your using Aspose.Cells.

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

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


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