Free Support Forum - aspose.com

Exception when setting a formula containing CELL("filename")

I am creating an excel file programatically and I am trying to add a hyperlink containing the path to the excel file. Is there any way using Aspose.Cells to set the value of CELL("filename") in an excel sheet and embed that value in a hyperlink?

I am doing the following:

string hyperlinkFormula = "=HYPERLINK(\"http://localhost/index.html?filePath\" & CELL(\"filename\"),\"Upload File\")";

cells[UPLOAD_HYPERLINK_CELL].Formula = hyperlinkFormula; // <== Exception is thrown here

StackTrace:

Aspose.Cells.CellsException: Error in Cell: B7-Invalid formula:"=HYPERLINK("http://localhost/index.html?filePath" & CELL("filename"),"Upload File")". at Aspose.Cells.x40937ad35b1cf5f7.x1f490eac106aee12(Cell xe6de5e5fa2d44af5) at Aspose.Cells.Cell.set_Formula(String value) at

Please try this attached fix.

Using this .dll resulted in some interesting behavior. The exception no longer occurs however when I added CELL("filename") to the =HYPERLINK() formula excel crashes when I click the hyperlink that is created.

I took it a step further and just set this formula in a cell: cells["B1"].Formula = "=CELL(\"filename\")";

The text shown in that cell is "filename" even though the formula displayed is correct "=CELL("filename"). It should show the full path name of that excel sheet.

Hi,

Thanks for the info,

Yes, we found the problem with =CELL function we will support this function to resolve it soon.

Thank you.

Please try this fix.

That did the trick! Thank you for such a speedy turnaround…