Free Support Forum - aspose.com

Aspose Error & Performance Issue

Hi,


We are using Aspose.Cells to generate Charts and getting attached errors when trying to open the excel.

We are currently using the version 7.0.2.2 as it is having good performance with chart.Calculate method.

Upgrading to latest version also does not fixes bot the issues with error and performance.

Please check if it is possible to have a fix both for error and performance
Hi,

Please download and try this fix: Aspose.Cells for .NET v7.3.1.5 and let us know your feedback.
We have made some enhancements regarding charts in it.

If you still find any issue as per your screen shots or any performance issue, please create a sample console application, zip it and post it here to show the issue our end. We will surely fix it soon.

Thank you.

We are still getting errors using the latest DLL.


Below is the sample code and sample data for the performance issue:

using System;<o:p></o:p>

using System.Drawing;

using Aspose.Cells;

using Aspose.Cells.Charts;

using Aspose.Cells.Drawing;

namespace SampleChartCode

{

class Program

{

static void Main(string[] args)

{

Workbook test = new Workbook(@"C:\testbook1.xlsx");

Worksheet wrktest = test.Worksheets["__testsheet"];

//Adding a new worksheet to the Workbook object

int sheetIndex = test.Worksheets.Add(SheetType.Chart);

//Obtaining the reference of the newly added worksheet by passing its sheet index

Worksheet worksheet = test.Worksheets[sheetIndex];

int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 1, 1, 25, 30);

//Accessing the instance of the newly added chart

Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"

chart.NSeries.Add("__testsheet!B2:GH168", true);

chart.NSeries.CategoryData = "__testsheet!A1:A168";

chart.NSeries.SecondCatergoryData = "__testsheet!A1:A168";

////Setting the chart type of 2nd NSeries to display as line chart

chart.NSeries[0].Name = "Area One";

for (int i = 0; i < 50; i++)

{

chart.NSeries[i].Type = Aspose.Cells.Charts.ChartType.LineStacked;

chart.NSeries[i].Line.Weight = WeightType.HairLine;

DataLabels datalabels = chart.NSeries[i].DataLabels;

datalabels.ShowValue = false;

}

chart.NSeries[10].Name = "Area Two";

chart.NSeries[10].Type = Aspose.Cells.Charts.ChartType.Line;

chart.NSeries[10].PlotOnSecondAxis = true;

chart.NSeries[10].Line.IsVisible = true;

chart.SecondCategoryAxis.IsVisible = true;

Console.WriteLine("Applying Formatting ...");

//Formatting chart area

chart.PlotArea.Area.BackgroundColor = Color.White;

chart.ChartArea.Area.BackgroundColor = Color.White;

chart.PlotArea.Area.ForegroundColor = Color.White;

chart.ChartArea.Area.ForegroundColor = Color.White;

chart.Name = "Sample Sheet";

chart.Title.Text = "Sample Chart";

chart.SizeWithWindow = true;

chart.ValueAxis.IsAutomaticMajorUnit = true;

chart.SecondValueAxis.IsAutomaticMajorUnit = true;

chart.SecondValueAxis.IsVisible = true;

chart.ValueAxis.IsAutomaticMaxValue = true;

chart.SecondValueAxis.IsAutomaticMaxValue = true;

chart.Calculate();

////Saving the Excel file

test.Save(@"c:\test2.xlsx");

}

}

}

Hi,


Thanks for the sample code and template file.

I did try your code with template file using v7.3.1.5, it works fine. The output file is opened fine into Ms Excel 2007. I have attached the output file here, please check it.

However, I found it take some time to calculate chart data. Please confirm, do you find this issue with the latest fix Aspose.Cells for .NET v7.3.1.5? We can log your issue after your confirmation to figure it out soon.

Thank you.

The sample code and file was for the performance issue and not the error with excel opening.


However, that issue is still occuring

Also, the chart calculate works fine with version 7.0.2.2

Hi,


As I shared in my previous reply, I can notice the performance issue regarding calculating chart’s data, it takes more time to process it. We will look into it soon.

I have logged a ticket with an id: CELLSNET-41082 for your issue. Once we have any update on it, we will let you know here.

Thank you.

Thanks for the update.


Regarding excel opening error, seems there some special characters in the attached data sheet which is preventing to open.

Can you check and update.


Hi,


As I requested you before, please create a sample console application with v7.3.1.5, zip it and post it here to show the Excel error opening issue. We will check it soon.

Thank you.

Sample code and excel attached


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Aspose.Cells;

using Aspose.Cells.Charts;

using Aspose.Cells.Drawing;

using System.Drawing;

namespace AsposeSampleProject

{

class Program

{

static void Main(string[] args)

{

Workbook wb = new Workbook(@"C:\Working\2\testData.xlsx");

Worksheet wrktest = wb.Worksheets["__ifnet"];

//Adding a new worksheet to the Workbook object

int sheetIndex = wb.Worksheets.Add(SheetType.Chart);

//Obtaining the reference of the newly added worksheet by passing its sheet index

Worksheet worksheet = wb.Worksheets[sheetIndex];

int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 1, 1, 25, 30);

//Accessing the instance of the newly added chart

Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

Cells cell = wrktest.Cells;

//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"

chart.NSeries.Add("__ifnet!B2:E10", true);

chart.NSeries.CategoryData = "__ifnet!A2:A10";

chart.NSeries.SecondCatergoryData = "__ifnet!A2:A10";

int i;

for ( i = 0; i < 3; i++)

{

string index = ((char)(66 + i)).ToString() + "1";

chart.NSeries[i].Name = cell[index].Value.ToString();

chart.NSeries[i].Type = Aspose.Cells.Charts.ChartType.Line;

chart.NSeries[i].Line.Weight = WeightType.HairLine;

DataLabels datalabels = chart.NSeries[i].DataLabels;

datalabels.ShowValue = false;

}

string cellindex = ((char)(66 + i)).ToString() + "1";

chart.NSeries[i].Name = cell[cellindex].Value.ToString();

chart.NSeries[i].Type = Aspose.Cells.Charts.ChartType.Line;

chart.NSeries[i].PlotOnSecondAxis = true;

chart.NSeries[i].Line.IsVisible = true;

chart.SecondCategoryAxis.IsVisible = true;

Console.WriteLine("Applying Formatting ...");

//Formatting chart area

chart.PlotArea.Area.BackgroundColor = Color.White;

chart.ChartArea.Area.BackgroundColor = Color.White;

chart.PlotArea.Area.ForegroundColor = Color.White;

chart.ChartArea.Area.ForegroundColor = Color.White;

chart.Name = "Sample Sheet";

chart.Title.Text = "Sample Chart";

chart.SizeWithWindow = true;

chart.ValueAxis.IsAutomaticMajorUnit = true;

chart.SecondValueAxis.IsAutomaticMajorUnit = true;

chart.SecondValueAxis.IsVisible = true;

chart.ValueAxis.IsAutomaticMaxValue = true;

chart.SecondValueAxis.IsAutomaticMaxValue = true;

chart.Calculate();

wb.Save(@"C:\Working\2\testDataResult.xlsx");

}

}

}

Hi,


I can notice the issue as pointed out in MS Excel, error is:
“Excel found unreadable content…”

I used your template file, here is the sample code:

Sample code:

Workbook wb = new Workbook(@“e:\test2\testData.xlsx”); //Template:http://www.aspose.com/community/forums/416639/postattachment.aspx

Worksheet wrktest = wb.Worksheets["__ifnet"];

//Adding a new worksheet to the Workbook object
int sheetIndex = wb.Worksheets.Add(SheetType.Chart);

//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = wb.Worksheets[sheetIndex];

int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 1, 1, 25, 30);

//Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
Cells cell = wrktest.Cells;
//Adding NSeries (chart data source) to the chart ranging from “A1” cell to “B4”
chart.NSeries.Add("__ifnet!B2:E10", true);

chart.NSeries.CategoryData = “__ifnet!A2:A10”;
chart.NSeries.SecondCatergoryData = “__ifnet!A2:A10”;

int i;
for (i = 0; i < 3; i++)
{
string index = ((char)(66 + i)).ToString() + “1”;
chart.NSeries[i].Name = cell[index].Value.ToString();
chart.NSeries[i].Type = Aspose.Cells.Charts.ChartType.Line;
chart.NSeries[i].Line.Weight = WeightType.HairLine;
DataLabels datalabels = chart.NSeries[i].DataLabels;
datalabels.ShowValue = false;
}

string cellindex = ((char)(66 + i)).ToString() + “1”;
chart.NSeries[i].Name = cell[cellindex].Value.ToString();
chart.NSeries[i].Type = Aspose.Cells.Charts.ChartType.Line;
chart.NSeries[i].PlotOnSecondAxis = true;
chart.NSeries[i].Line.IsVisible = true;
chart.SecondCategoryAxis.IsVisible = true;

Console.WriteLine(“Applying Formatting …”);

//Formatting chart area
chart.PlotArea.Area.BackgroundColor = Color.White;
chart.ChartArea.Area.BackgroundColor = Color.White;
chart.PlotArea.Area.ForegroundColor = Color.White;
chart.ChartArea.Area.ForegroundColor = Color.White;
chart.Name = “Sample Sheet”;
chart.Title.Text = “Sample Chart”;
chart.SizeWithWindow = true;
chart.ValueAxis.IsAutomaticMajorUnit = true;
chart.SecondValueAxis.IsAutomaticMajorUnit = true;
chart.SecondValueAxis.IsVisible = true;
chart.ValueAxis.IsAutomaticMaxValue = true;
chart.SecondValueAxis.IsAutomaticMaxValue = true;


chart.Calculate();
wb.Save(@“e:\test2\testDataResult.xlsx”);

When I open the output file into Ms Excel 2007, it gives me error.

I have logged a separate ticket with an id: CELLSNET-41120 for this issue. We will look into it soon.

Thank you.

Hi,

We have fixed this issue.

Please download and try this fix: Aspose.Cells for .NET v7.3.2.2 and let us know your feedback.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,

Do you have any updates on when will be the fix for issue CELLSNET-41082 available?

Regards
Arihant

Hi,


It should be fixed in the latest version/fix v7.3.3.

Please download and try this fix: Aspose.Cells for .NET v7.3.3.1 and let us know your feedback.

Thanks for the update. But the issue 41082 is not mentioned in the announcement here:


http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry420470.aspx

Wanted to confirm if that is available.

Regards
Arihant

Hi,


The issue’s status is fixed, so we have requested you to kindly try our latest version/fix v7.3.3.x and let us know your feedback.

Thank you.

Tried the same code as mentioned below with the latest version of Aspose.Cells v 7.3.3.1, but still it is taking same time while using the chart.calculate method. The same works fine in version 7.0.2.2


Code:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using Aspose.Cells;
using Aspose.Cells.Charts;
using Aspose.Cells.Drawing;

namespace PerfomanceIssue {
class Program {
static void Main(string[] args) {
Workbook test = new Workbook(@“C:\bin\testbook1.xlsx”);
Worksheet wrktest = test.Worksheets["__testsheet"];

        <span style="color:green;">//Adding a new worksheet to the Workbook object</span>
        <span style="color:blue;">int</span> sheetIndex = test.Worksheets.Add(<span style="color:#2b91af;">SheetType</span>.Chart);

        <span style="color:green;">//Obtaining the reference of the newly added worksheet by passing its sheet index</span>
        <span style="color:#2b91af;">Worksheet</span> worksheet = test.Worksheets[sheetIndex];

        <span style="color:blue;">int</span> chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.<span style="color:#2b91af;">ChartType</span>.Line, 1, 1, 25, 30);

        <span style="color:green;">//Accessing the instance of the newly added chart</span>
        Aspose.Cells.Charts.<span style="color:#2b91af;">Chart</span> chart = worksheet.Charts[chartIndex];

        <span style="color:green;">//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"</span>
        chart.NSeries.Add(<span style="color:#a31515;">"__testsheet!B2:GH168"</span>, <span style="color:blue;">true</span>);

        chart.NSeries.CategoryData = <span style="color:#a31515;">"__testsheet!A1:A168"</span>;
        chart.NSeries.SecondCatergoryData = <span style="color:#a31515;">"__testsheet!A1:A168"</span>;

        <span style="color:green;">////Setting the chart type of 2nd NSeries to display as line chart</span>
        chart.NSeries[0].Name = <span style="color:#a31515;">"Area One"</span>;

        <span style="color:blue;">for</span> (<span style="color:blue;">int</span> i = 0; i < 50; i++) {
            chart.NSeries[i].Type = Aspose.Cells.Charts.<span style="color:#2b91af;">ChartType</span>.LineStacked;
            chart.NSeries[i].Line.Weight = <span style="color:#2b91af;">WeightType</span>.HairLine;
            <span style="color:#2b91af;">DataLabels</span> datalabels = chart.NSeries[i].DataLabels;
            datalabels.ShowValue = <span style="color:blue;">false</span>;
        }

        chart.NSeries[10].Name = <span style="color:#a31515;">"Area Two"</span>;
        chart.NSeries[10].Type = Aspose.Cells.Charts.<span style="color:#2b91af;">ChartType</span>.Line;
        chart.NSeries[10].PlotOnSecondAxis = <span style="color:blue;">true</span>;
        chart.NSeries[10].Line.IsVisible = <span style="color:blue;">true</span>;
        chart.SecondCategoryAxis.IsVisible = <span style="color:blue;">true</span>;

        <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Applying Formatting ..."</span>);
        <span style="color:green;">//Formatting chart area                    </span>

        chart.PlotArea.Area.BackgroundColor = <span style="color:#2b91af;">Color</span>.White;
        chart.ChartArea.Area.BackgroundColor = <span style="color:#2b91af;">Color</span>.White;
        chart.PlotArea.Area.ForegroundColor = <span style="color:#2b91af;">Color</span>.White;
        chart.ChartArea.Area.ForegroundColor = <span style="color:#2b91af;">Color</span>.White;
        chart.Name = <span style="color:#a31515;">"Sample Sheet"</span>;
        chart.Title.Text = <span style="color:#a31515;">"Sample Chart"</span>;
        chart.SizeWithWindow = <span style="color:blue;">true</span>;
        chart.ValueAxis.IsAutomaticMajorUnit = <span style="color:blue;">true</span>;
        chart.SecondValueAxis.IsAutomaticMajorUnit = <span style="color:blue;">true</span>;
        chart.SecondValueAxis.IsVisible = <span style="color:blue;">true</span>;
        chart.ValueAxis.IsAutomaticMaxValue = <span style="color:blue;">true</span>;
        chart.SecondValueAxis.IsAutomaticMaxValue = <span style="color:blue;">true</span>;


        chart.Calculate();

        <span style="color:green;">////Saving the Excel file</span>
        test.Save(<span style="color:#a31515;">@"c:\bin\test2.xlsx"</span>);
    }
}

}


Attached is the sample datasheet


Hi,


I am able to notice the issue, you are right as I have tested using your code with template file using Aspose.Cells for .NET v7.3.3.2 , I can see the performance issue (it takes more time than it should to render/calculate the chart). I have reopened your issue “CELLSNET-41082”. We will look into it soon.

Thank you.

Do you have an update on when the fix will be available for issue: CELLSNET-41082