Custom formula name

I have an Excel template where I added a function named "W".

With Aspose I set many cells that use this formula but it's a bit slow.
It takes about 30 seconds for 10 000 cells. It's not that bad but if I rename that function to "WAA", it takes 1 second.

I set the formula this way

xlSheet.Cells[i,j].Formula = strFormula;

The formula looks like
=W(-547.74,$D1993)
or
=WAA(-547.74,$D1993)

Why is it slower when the function is named "W"?

I have the version 4.2 of Aspose.Cells

Thank you

Alexandre

Hi Alexandre,

Thanks for considering Aspose.

We will check it and get back to you soon.

Thank you.

Could you please post your template file here? Thank you.

It's not related to the template file, I can replicate this with a blank workbook. Of course Excel can't calculate the formula but the performance is the same with Aspose.Cells.

Aspose.Cells.Workbook w = new Aspose.Cells.Workbook();

w = new Aspose.Cells.Workbook();

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

{

for(int j = 0; j < 20; ++j)

{

w.Worksheets[0].Cells[i,j].Formula = "=W(123.45,1)";

}

}

That takes 14 seconds

If I change the line to w.Worksheets[0].Cells[i,j].Formula = "=WAA(123.45,1)", it takes 0.2 seconds

Thank you

Alexandre

Hi Alexandre,

This is my console test case:

DateTime start = DateTime.Now;
Aspose.Cells.Workbook w = new Aspose.Cells.Workbook();

w = new Aspose.Cells.Workbook();

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

{

for(int j = 0; j < 20; ++j)

{

w.Worksheets[0].Cells[i,j].Formula = "=W(123.45,1)";

}

}

DateTime end = DateTime.Now;
TimeSpan span = end - start;
Console.WriteLine(span.TotalSeconds);

It takes about 0.5-0.6 seconds.

If I change the formula to WAA(123.45,1), it takes about 0.4-0.5 seconds.

Thank you

I "found" the problem. When I execute the software "outside" VS .Net, the performance with W is about the same than with WAA. (about 0.3 seconds).

I don't know why it's that slow from VS (debug or release it's the same performance).

Maybe a restart of your VS or your machine will solve this problem.