Adding hyperlinks in Excel[2007] in C# - Within Excel it self

前端 未结 4 2134
醉梦人生
醉梦人生 2021-02-08 11:00

Can anybody tell me how we can add a hyperlink in Excel (2007 or later) from a cell in one sheet to a cell in another sheet using Office Interop in .NET (c#)

For example

4条回答
  •  时光取名叫无心
    2021-02-08 11:37

    To add a link to a picture (already inserted into the sheet):

    Hyperlinks hyperlinks = ws.Hyperlinks;
    Hyperlink hyperlink = hyperlinks.Add(picture.ShapeRange.Item(1), "http://stackoverflow.com");
    

    You are not adding it directly to the picture, but the 1st item in it's ShapeRange. (Whatever that is...)

提交回复
热议问题