Articles in this section
Category / Section

How to check if a cell in a Grid is a formula cell or not?

2 mins read

The custom server has implementation to detect a formula cell with formula and value in it. IsFormulaCell is the function that servers the information for a given row and column index. This function points out the formula used in that cell and the result of the formula. This returns false when the cell is not a formula cell.

The syntax for this function is,

IsFormulaCell(row, col, formula, computedValue)

Where, row is the index of the row, col is the index of the column, formula retrieves the formula of the cell, computedValue retrieves the computed or calculated value of the cell, IsFormulaCell returns true when the given row and col is a FormulaCell, false otherwise.

The sample script is as follows.

QTP script

SwfWindow("GridControl").Move 592,516

SwfWindow("GridControl").SwfObject("gridControl1").SetCurrentCell 8,4

SwfWindow("GridControl").SwfObject("gridControl1").SetCellData 8,4,"40"

row = 8

IsFormula = false

formula = ""

result =""

For col = 5 To 8

IsFormula = SwfWindow("GridControl").SwfObject("gridControl1").IsFormulaCell(row, col, formula, result)

If IsFormula Then

MsgBox ("The cell "&row &", "& col &" is a Formula Cell, with Formula "& formula&" and results "& result)

End If

Next

C:\Users\ApoorvahR\Desktop\Note.pngNote: Run the above script in the QTP server.

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/general/FormulaCell-1232635585.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied