0

I have a problem with some excel files. I'have stored three excel files in the azure cloud storage. I've implemented a download option from my website. I'am opening the file via Gembox on the server to insert one link per row with the help of the hyperlink option of Gembox.

When opening the Excel-File for the first time, instead of showing the text of the hyperlink, excel shows the error value '#NAME?'. However, there is also an security warning, so it opens in an protected view.

#NAME? error

When I click the button to edit the worksheet, the text shows appropriate.

Texts shows approriate

Any ideas on how the text can be shown appropriate from the start?

1 Answers1

0

Is that a HYPERLINK formula? That would explain this behavior.

To avoid this try using the ExcelCell.Hyperlink property. You can find an example of its usage on this Hyperlink example.

var workbook = new ExcelFile();
var worksheet = workbook.Worksheets.Add("Hyperlinks");
var hyperlinkStyle = workbook.Styles[BuiltInCellStyleName.Hyperlink];

var cell = worksheet.Cells["B1"];
cell.Value = "Link to GemBox homepage";
cell.Style = hyperlinkStyle;
cell.Hyperlink.Location = "https://www.gemboxsoftware.com";
cell.Hyperlink.IsExternal = true;

Or you can continue to use the HYPERLINK formula and to resolve this you would need to execute the ExcelFile.Calculate method before saving the ExcelFile.

Note, the latest version of GemBox.Spreadsheet has support for recalculating HYPERLINK function.

Mario Z
  • 4,328
  • 2
  • 24
  • 38
  • Hey Mario, thanks for your answer. No it's not an hyperlink formula. My code looks actually the same as yours. Also I use workbook.Calculate() before returning it. – chey.tii Nov 12 '21 at 08:48
  • @chey.tii I was unable to observe this issue when using the `Hyperlink` property. Can you upload somewhere your Excel file and send it to me so that I can investigate it? – Mario Z Nov 12 '21 at 10:34
  • @chey.tii just wanted to check again, are you still having issue with this? Also, are you using the latest version? Note that the support for calculating the HYPERLINK formula was recently added, so you need to use a newer version. – Mario Z Nov 19 '21 at 02:46