Hallo,
when i read the result of a cell with a formular how has a function (like SUM()) or a referenz (sheetname!Range) linked to a worksheet (itself or another) in the workbook the result (.GetResultValueAsString ) ist "0" or a text (the formular itself) and not the result. Simple formulars related to cells in the worksheet are ok.
Example:
The cell formular looks like this:
1. =SUMME(L23:L30) ==> GetResultValueAsString result = "0"
2. {=WENNFEHLER(INDEX(Bestellliste!E:E;KKLEINSTE(WENN(Bestellliste!$A$1:$A$1131="x";ZEILE($1:$991));ZEILE(A3)));"")} ==> GetResultValueAsString result = "=WENNFEHLER(INDEX(Bestellliste!E:E;KKLEINSTE(WENN(Bestellliste!$A$1:$A$1131="x";ZEILE($1:$991));ZEILE(A3)));"")"
VB code:
Dim iCellValue As ICellValue
iCellValue = TryCast(workbook.ActiveWorksheet.Cells(row, col).GetValue().Value, ICellValue)
If iCellValue IsNot Nothing Then
Dim format As CellValueFormat = workbook.ActiveWorksheet.Cells(row, col).GetFormat().Value
Dim valueAsString As String = iCellValue.GetValueAsString(format)
'valueAsString
Dim resultValueAsString As String = iCellValue.GetResultValueAsString(format)
'resultAsString
Dim valueType As CellValueType = iCellValue.ValueType
'valueType = Formula ' ==> allways Text{4} with komplex formular
'resultValueType = Number
Dim resultValueType As CellValueType = iCellValue.ResultValueType
End If
DLL Version: 2015.2.728.40
What's wrong? Are their any restriction to resolve formulars?
Regards
Harald