CalculateFormula changed #REF! to #NAME?

Continuing the discussion from Error opening ODS file:

Hello,

based on the recommendation I found another problem with Excel format.

_workbook = new Workbook(FileWorking);
_workbook.CalculateFormula();

// Without Calc: #REF!
// Returned: #REF!
var cellValue = _workbook.Worksheets[0].Cells["A1"].DisplayStringValue;

_workbook = new Workbook(FileProblem);
_workbook.CalculateFormula();

// Without Calc: #REF!
// Returned: #NAME?
var cellValue2 = _workbook.Worksheets[0].Cells["A1"].DisplayStringValue;

Please have a look at my example (16.1 KB) with the attached files.

Thank you.

@mservdev,

Thanks for the sample code and template file.

After an initial test, I am able to observe the issue as you mentioned by using your sample code with your template file. I found Workbook.CalculateFormula has changed “#REF!” to “#NAME?” in the cell:
e.g
Sample code:

Workbook _workbook; 
 const string FileException = "E:\\test2\\BugDemo\\Exception.xlsx"; 
         
             _workbook = new Workbook(FileException); 
            _workbook.CalculateFormula(); 

            var cellValue2 = _workbook.Worksheets[0].Cells["A1"].DisplayStringValue;//#NAME? 

I have logged a ticket with an id “CELLSNET-45968” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Hello @Amjad_Sahi,

first of all, please use my example from earlier. I found the same issue (only with xlsx!?) at following code:

_workbook = new Workbook(FileProblem);
_workbook.Save("C:\Data\Test.xlsx", SaveFormat.Xlsx") // Changed to #NAME?

// and the same with 

_workbook.Save("C:\Data\Test.xls", SaveFormat.Excel97To2003") // Changed to #NAME?

Which file you are talking about, an ODS file (e.g “ods.ods”, you shared in your other thread)? If this is the case, kindly do share all these details in the relevant thread (if possible).

Hey,

sorry for the misunderstanding, I meant the example of the initial post.

@mservdev,

Thanks for providing us further details.

Well, the issue is related to Aspose.Cells formula calculation engine which does not evaluate/calculate the formula and changes “#REF!” to “#NAME?” in the cell for your XLSX file (“Exception.xlsx”) only.

Please spare us a little time, we will figure it out soon.

1 Like

Hello will this problem also get a issue number?

@mservdev,

I think it is not needed as it is an attribute to existing issue, i.e., “CELLSNET-45968”.

Once we have an update on it, we will let you know here.

I honestly didn’t see the ticket number, sorry. Unfortunately the fix did not seem to be in the release 18.3.0 or was forgotten to update the changelog?

@mservdev,

Yes, this fix is not included in the latest version: Aspose.Cells for .NET v18.3. We will include it in v18.4 hopefully. The reason is we got to enhance the whole formula calculation engine a bit related to your issue, so it might take a little time. In the mean time we might provide you the fix in the next week hopefully which you may use it for your needs.

1 Like

The issues you have found earlier (filed as CELLSNET-45968) have been fixed in Aspose.Cells for .NET 18.4. Please also check the document/article for your reference: Install Aspose Cells through NuGet|Documentation