Add Hyperlink to Cell in Excel 2007 Using Open XML SDK 2.0
Posted
by amurra
on Stack Overflow
See other posts from Stack Overflow
or by amurra
Published on 2010-05-25T14:35:28Z
Indexed on
2010/05/26
15:51 UTC
Read the original article
Hit count: 1241
I can't seem to find any documentation or code samples on how to add a hyperlink to a cell in Excel 2007 using the open xml sdk 2.0. I am using the following code, but is there a step I am missing?
WorksheetPart workSheetPart = ExcelUtilities.GetWorkSheetPart(mWorkBookPart, "Program");
workSheetPart.AddHyperlinkRelationship(new Uri("http://www.google.com", UriKind.Absolute), true);
workSheetPart.Worksheet.Save();
mWorkBookPart.Workbook.Save();
Then when I try and open the Excel document it says the file is corrupted because the relationship Id for the hyperlink cannot be found. How do you setup or create that relationship Id?
© Stack Overflow or respective owner