Hello,
I have an excel table and one of the columns contains reference to a file on the computer file system. I have to link the cell value to that file, so when you click the cell the file opens.
I know that to do this i have to use the APPLYFORMULA in this way
xFoglio.Rows(rownumber).Cells(columnnumber).ApplyFormula("=HYPERLINK("C:\MyFile.txt";"MyFile.txt")")
It works, but there is only one problem: the value of the cell is "MyFile.txt" but it is not showed as an hyperlink (I mean, it is not underlined and not in blue color), it appears as normal text. To obtain the hyperlink you have to select the cell and press enter.
So the cell actually behaves like an hyperlink (if you click the cell the file is opened) but it is not showed as an hyperlink
Claudio Di Flumeri
Hi Claudio,
I tried this out in Excel using the HyperLink function and it does display as a link to me (underlined blue text). So I can only assume that something in your code is doing something to change the appearance of the cell.
How exactly are you creating the Excel file? You are posting in the Excel forum, but your code appears to be referencing a grid cell. Is this WinGrid or WebGrid? Are you using the Infragistics UltraGridExcelExporter?
If you are using the exporter component, then I'm guessing that the exporter itself is overwriting the Style of the cell so that it looks like the cell in the grid and this is overriding the default link appearance in Excel.
If that's the case, then I think you could prevent this by canceling the export of the cell using an event on the Exporter (which is probably what you are using to set the formula in the first place). But this is only a guess, there's not enough information here for me to be sure.
No Im not using WinGrid or WebGrid, I am working on an excel worksheet. This is the code I use:
Dim xExcel As New Infragistics.Excel.Workbook(Infragistics.Excel.WorkbookFormat.Excel97To2003)Dim xFoglio As Infragistics.Excel.Worksheet = xExcel.Worksheets.Add("File Allegati") '#########################xFoglio.Workbook.DefaultFontHeight = 200xFoglio.PrintOptions.BottomMargin = 0.8xFoglio.PrintOptions.TopMargin = 0.8xFoglio.PrintOptions.LeftMargin = 0.8xFoglio.PrintOptions.RightMargin = 0.8xFoglio.PrintOptions.FooterMargin = 0.5xFoglio.PrintOptions.HeaderMargin = 0.5xFoglio.PrintOptions.Header = "File Allegati"xFoglio.PrintOptions.Orientation = Infragistics.Excel.Orientation.Landscape
'.......
'.....
xExcel.Save(fileName)
I am not changing the Style of that cell