Free Support Forum - aspose.com

Custom defined function

Hi

I have an excel sheet with custom defined functions. When I am importing this sheet into Aspose.Grid or Aspose.Cells the functions are not imported. I would like to see them in the cell.formula property of Aspose.Grid and handle the calculation of the formula's in the underlying code.

Rob Vader

Hi,

I defined a custom function named "myfunc" in EXCEL, and put a formula "=myfunc()" is cell "A1", then saved to a xls file. When I open the file in the gridweb, it shows "#NAME?". But the cell's Formula property is correct. So please give me more information about what you really want to do against the custom funciton.

Thank you.

the problem occurs when I have my functions embedded in a XLA file attached as an add-in to my XLS file.

The ImportExcelFile function will not return the function.

I tried to load a XLS file with Aspose.Cells using the following code:

Dim EXCEL As New Workbook

EXCEL.Open(myfile.InputStream)

Dim cll As Cell

Dim wb As Worksheet

Me.GridWeb1.WebWorksheets.Clear()

For Each wb In EXCEL.Worksheets

Me.GridWeb1.WebWorksheets.Add(wb.Name)

For Each cll In wb.Cells

If cll.IsFormula Then

Me.GridWeb1.WebWorksheets(wb.Index).Cells(cll.Row,cll.Column).Formula = cll.Formula

Else

Me.GridWeb1.WebWorksheets(wb.Index).Cells(cll.Row,cll.Column).PutValue(cll.Value)

End If

Next

Next

The cell.IsFormula is triggered but cell.Formula does not have a value

Which version of Aspose.Cells are you using? Have you tried latest v4.1?

If it still doesn't return a correct formula, could you please post your Excel file here? Thank you.