Excel File doesn't show Hyperlink in protected view (Gembox and Kendo)

266 Views Asked by At

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

There are 1 best solutions below

3
Mario Z On

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.