We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cell event holding formula result

I am using the Aspose.Cells.GridDesktop control.


I am, wanting the event when the cell formula is evaluated. I would like to check the value is not too large.

The CellDataChanged event holds the formula but the cell.value = 0. I need to know the result of the formula.

Hi,

You may using following code snippet. If still there is any confussion please reach us with the sample application.

Code:

Private Sub GridDesktop1_CellDataChanged(ByVal sender As System.Object, ByVal e As Aspose.Cells.GridDesktop.CellEventArgs) Handles GridDesktop1.CellDataChanged

Dim CellValue As String = e.Cell.Value.ToString()

End Sub

Thanks,

In initial question, I have already tried what you suggested.


In CellDataChanged, the e.cell.value = 0 when e.Formula exists.

My code:

Private Function SaveCell(ByVal e As Aspose.Cells.GridDesktop.CellEventArgs) As Boolean
'Should validate at this point or within the below CASE
Dim NewVal As Integer = e.Cell.Value.ToString
Dim NewFormula As String = e.Cell.Formula

End Function

e.Cell.Formula = "=3+4"

NewVal = 0, please advise why?

Both your sample and mine do not evaluate the formula.

Hi Phil,

We have enhanced the CellDataChanged event in Aspose.Cells.GridDesktop v2.3.0.2002.
When the formula is evaluated, the CellDataChanged event will be fired again.
You can get the formula result from e.Cell.Value.

Please find the updated version attached.

Thanks,