Free Support Forum - aspose.com

CalculateFormula not working right when SEARCH function with wildcards is used with Aspose.Cells for .NET in C#

Hello,

Using Aspose.Cells v7.4.2.0.

Here is the code I am using:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A3"].PutValue("ab-c-d");

//Excel Formula
//=SEARCH("-?-?*", A3, 1) returns:3

var formula1 = @"=SEARCH(" + @"""" + "-c-d" + @"""" + ", A3, 1)";
var formula2 = @"=SEARCH(" + @"""" + "-?-?" + @"""" + ", A3, 1)";

//formula1, formula2 above basically translates to =SEARCH("-c-d",A3,1) and =SEARCH("-?-?,A3,1)


var result1 = worksheet.CalculateFormula(formula1); //returns 3
var result2 = worksheet.CalculateFormula(formula2); //should return 3, but does not. Returns value of type Aspose.Cells.ErrorType.Value

---

When I use wildcards in the SEARCH function, it does not work. I tried SEARCH("-*",A3,1), but that fails too.

My goal is to check if the value in each cell is of the format xxxxx-x-x

Any ideas or suggestions?

Thanks.

Hi,

Thanks for your posting and using Aspose.Cells.

After initial investigation, we were able to find this issue. The formula works fine in MS-Excel but does not work in CalculateFormula. We have logged this issue in our database. We will look into this issue and resolve it. 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-41562.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have fixed the issue.

Please download and try this fix: Aspose.Cells for .NET (Latest Version) and let us know your feedback.

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


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