Please see the document with example code on ICustomFunction feature for your reference. The sample code is in .NET but you may easily convert it to Python. Please note, Aspose.Cells for Python via .NET is very similar to Aspose.Cells for .NET. So, you can refer to the docs.
Thanks. I tried to run it but got error. My code:
from aspose.cells import Workbook, ICustomFunction
class CustomCalcImpl(ICustomFunction):
def calculate_custom_function(self, function_name, params_list, context_objects):
a = 4
b = 4
return a*b
if __name__ == '__main__':
workbook = Workbook()
workbook.calculate_formula(False, CustomCalcImpl())
i’m getting error:
class CustomCalcImpl(ICustomFunction):
TypeError: type ‘aspose.cells.ICustomFunction’ is not an acceptable base type
The error seems to be related to missing import and implementation reference to ICustomFunction class. Please import and implement ICustomFunction at the start of your program. Please do it properly and accordingly in your code for Python via .NET.
@Amjad_Sahi
I have edited post and corrected formatting of code area. Please have a look one more time.
Imports are done in first line and ICustomFunction is used as parent class of my custom CustomCalcImpl class with overriden calculate_custom_function method.
Still getting the same error. Am I missing something?
@t.mezykowski
We will check your updated code. If there are any updates on it, we will notify you. Thanks!
@t.mezykowski
Unfortunately, inheriting from an abstract class is not supported for Aspose.Cells for Python via .NET yet.We plan to support it in 2023 H1 and we will notify you as soon as we support it.
This feature request is logged in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSPYTHONNET-113
You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@xinyazhu
Do you mean that Custom Function currently will not wotk in Aspose.Cells for Python via .NET at all?
Or is there any other way to use ICustomFunction without need of inheriting from abstract class (from ICustomFunction)?
@t.mezykowski
Sorry, there are no other alternative way at present. But we have raised the priority of this requirement and we strive to implement this feature between March and April. Once we release, we will notify you as soon as possible. Sorry for any inconvenience this may have caused.
@xinya.zhu i saw there was new release in March, but couldn’t verify if ICustomFunction was fixed.
Do you have any updated info about potent release with fix for this functionality?
I am afraid, the feature (logged as “CELLSPYTHONNET-113”) is not supported yet. Once we support it or we have some other updates on it, we will let you know here.
We are sorry for any inconvenience caused!
@amjad.sahi There was new version release but it looks like this feature is still not available.
Lack of support for ICustomFuncton is actually blocking us from buying the license for Aspose Cells for Python via Net.
Do you know when this can be fixed?
Yes, the new version does not include the feature in it. We will check if we could provide latest updates on it. We will get back to you soon.
@t.mezykowski
I have communicated with the development team, and we plan to support this feature in the May release. We apologize for making you wait so long!
@t.mezykowski
Hi,We intended to support the requirement (logged as “CELLSPYTHONNET-113”) in the May version. However, we encountered some difficulties during the development process, so we are temporarily unable to meet your needs. We apologize for any inconvenience caused and appreciate your understanding. We will notify you as soon as we complete the development. Thank you!
We are sorry but the feature “Support inherit from an abstract class” (logged earlier as “CELLSPYTHONNET-113”) is not implemented yet. We will check if we could provide latest updates/ETA on it.
We will get back to you soon.
First of all, we sincerely apologize for not being able to meet the planned deadlines each time. The timeframes provided to you were based on our analysis and understanding of the feature at that particular moment. Regarding this feature, allow me to explain the reasons for the repeated delays. It is an exceptionally complex functionality, requiring us to modify approximately 40-50% of the existing code. It is precisely due to this complexity and uncertainty that we have encountered issues during development, leading to the continuous postponement of our initial estimates.
Considering the current situation, we have raised the priority of this task to the highest level. Our plan is to aim for a release in late August or September to support the functionality of interface inheritance (though, to be honest, this is still subject to expectations). Once we achieve this support, we will promptly inform you. We deeply apologize for any inconvenience caused and thank you for your understanding.
Hi. Any news regarding support of custom functions in aspose python wrapper?