Posted 23 November 2021, 8:47 am EST
How to use custom function which is written in excel template except set it directly in java code like example below.
[i]worksheet.getRange("C1").setFormula("=MyConditionalSum(A1:A10)");[/i]
https://www.grapecity.com/documents-api-excel-java/docs/online/ManageCustomFunctions.html
And were we write code when some of function called before processTemplate and some of function will call after it.
In below code I can able to achieve it with template string {{==textfun(“text1”)}} in template excel file.
FindOptions fo = new FindOptions();
fo.setLookIn(FindLookIn.Formulas);
IRange usedRange = activeSheet.getUsedRange();
IRange find = null;
do
{
find = usedRange.find(functionName, find, fo);
if(find!=null)
System.out.println(find.getValue());
}while(find!=null);
Still I have problem here,
- we need to define sheet.
- If Used range cover maximum region then operation below slow
- Above getValue() statement make it call custom function otherwise no call
- Pre and post we need to scan usedRatio in our code to set value
Can you help me how I achieve it?