This project has moved. For the latest updates, please go here.

HYperlink without display text

Mar 19, 2013 at 7:46 PM
Hello,
Is it possible to have an internal Hyperlink that has no display text so that it will just display the underlying cell value? I have a summary sheet that has cell formulas that total the values of the underlying data sheet, and I need to be able to click on a total and jump the user to the underlying data.

I see that there is a constructor that takes a single string arg, but it's a Uri instead of a ReferenceAddress. Note that I also have places that DO have a label, and if I use the ReferenceAddress, String constructor it works fine.

Thanks for a great product,
Dean
Apr 1, 2013 at 10:43 PM
Edited Apr 1, 2013 at 10:45 PM
So I figured out how to make this work, it's a matter of setting things in the right order. First, if you pass null to the ExcelHyperLink constructor, it causes EPPlus to leave the display attribute out of the hyperlink XML. Then set the formula, and it works:
srcSht.Cells[srcRow, srcCol].Hyperlink = new ExcelHyperLink(dest_rng.FullAddress, null);
srcSht.Cells[srcRow, srcCol].Formula = "'Sheet2'!A5";
Maybe as a future enhancement, passing null as the display text would tell EPPlus to create the hyperlink, but not blank out the existing formula/value if any.

Hope this helps someone else,
Dean