Aspose.Cells for .Net 18.1で以下の計算式の結果がExcelの自動計算と異なります。
ご確認のほどよろしくお願いいたします。
【操作方法】
1)計算式を適当なセルに入力
=IF(A1>=1,“NG”,“OK”)
2)Aspose.cellでA1セルに""(ブランク)を入力
【結果】
結果が「NG」になります。
※ExcelではOKになります。
Aspose.Cells for .Net 18.1で以下の計算式の結果がExcelの自動計算と異なります。
ご確認のほどよろしくお願いいたします。
【操作方法】
1)計算式を適当なセルに入力
=IF(A1>=1,“NG”,“OK”)
2)Aspose.cellでA1セルに""(ブランク)を入力
【結果】
結果が「NG」になります。
※ExcelではOKになります。
詳細をありがとう。
私は次のサンプルコードを使ってv 18.9でシナリオ/ケースをテストしましたが、期待通りに機能しました。 さまざまなケースについては、サンプルコードスニペットを参照して、ラインに添付されているコメントを使用して理解してください。
例えば
サンプルコード:
Workbook excel = new Workbook();
Cells cells = excel.Worksheets[0].Cells;
// Create a Cell object and get the B1 cell.
Aspose.Cells.Cell cell = cells[0, 1];
cell.Formula = "=IF(A1>=1,\"NG\",\"OK\")";
// Create a Cell object and get the A1 cell.
Aspose.Cells.Cell cell1 = cells[0, 0];
//Case1
cell1.PutValue("");
//Or
//cell1.PutValue(String.Empty);
excel.CalculateFormula();
Debug.WriteLine("Result " + cell.StringValue);//"NG" - It will rightly gives "NG". MS Excel also gives "NG" as I checked.
//Case2
//If we enter "null" it will rightly gives "OK"
cell1.PutValue(null);
excel.CalculateFormula();
Debug.WriteLine("Result " + cell.StringValue);//"OK"
//Case3
//First we enter value and then removes/clear the value of A1 cell, it will rightly gives "OK"
cell1.PutValue(123);
excel.Worksheets[0].Cells.ClearRange(0,0,0,0);
//Since A1 cell with its data is removed, so we got to instiantiate it again it.
cell1 = cells[0, 0];
excel.CalculateFormula();
Debug.WriteLine("Result " + cell.StringValue);//"OK"
excel.Save("e:\\test2\\out1.xlsx");
問題や混乱があればお知らせください。 それでも問題が解決しない場合は、テンプレートファイルをサンプルコード(実行可能ファイル)に書き込んで問題を表示してください。 私はすぐにそれをチェックします。