Get value from formula
Hi,
Sorry but i didnt find this anywere, so I need to ask you what I need to do to retreave the result of a formula via Javascript.
var obj = $("#Spreadsheet").ejSpreadsheet('instance');
obj.XLEdit.getPropertyValue(6,4); // returns "=SUM(E5:E6)"
obj.getCell(6,4); // return the cell html element
But I need the actual value of the E5 + E6
Please give me the answer.
Best Regards
SIGN IN To post a reply.
3 Replies
SK
Shanmugaraja K
Syncfusion Team
May 16, 2017 07:01 AM UTC
Hi Bruno,
Thanks for using Syncfusion products.
We would like to let you know that we suggest you to use pass “value2” or "calcValue" to getPropertyValue method to get the result of the formula. Please refer the below code example,
[JS]
| $(function () { $("#Spreadsheet").ejSpreadsheet({ // Rendering Spreadsheet }); }); function Result() { var xlObj = $('#Spreadsheet').ejSpreadsheet('instance'); // B2 cell has formula =CONCATENATE("one","big") and result is "onebig". alert("The Formula " + xlObj.XLEdit.getPropertyValue(1, 1, "value") + " result is: " + xlObj.XLEdit.getPropertyValue(1, 1, "value2")); } <input type="button" value="Formula Result" onclick="Result()" /> <div id="Spreadsheet"></div> |
Please refer the below documentation and JSPlayground link,
Documentation link: https://help.syncfusion.com/api/js/ejspreadsheet#methods:xledit-getpropertyvalue
JSPlayground link: https://jsplayground.syncfusion.com/zgtzedlr
Regards,
Shanmugaraja K
BF
Bruno Figueiredo
May 16, 2017 10:37 AM UTC
Hi,
Well I totaly missed that.
Problem solved.
But allow me to sugest something,
I think you should simplify your function names. like:
XLEdit.getCellValue(x,y) and getFormulaValue(x,y) or getCellCalcValue(x,y)
Or something else, I don't know, but be more intuitive.
Thank You,
and thank you again for the fast reply
SK
Shanmugaraja K
Syncfusion Team
May 18, 2017 09:47 AM UTC
Hi Bruno,
Thanks for your suggestion, we have an option to get the formula cell value. If we add the separate methods like getting cell value and getting formula cell value, it may increase the size of the source. Since, we have lot of methods in our ejSpreadsheet control.
Regards,
Shanmugaraja K
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
BF Bruno Figueiredo
- May 15, 2017 03:50 PM UTC
- May 18, 2017 09:47 AM UTC