2013-11-25 79 views

回答

0

點擊您要製作超鏈接的單元格。轉到插入>超鏈接。

在彈出的窗口中使用的地方在這個文件中

戈登

add hyperlink

我不認爲電池串它可能只是讓部分的超鏈接。

0

這是一個非常類似的例子,所以我希望這將有助於。

static void Main(string[] args) 
    { 
     var xla = new Microsoft.Office.Interop.Excel.Application(); 
     var wbosszes = xla.Workbooks.Add(XlSheetType.xlWorksheet); 

     Worksheet ws = (Worksheet)xla.ActiveSheet; 
     ws.Name = "test"; 

     xla.Visible = true; 

     List<Content> forExample = new List<Content>(); 

     var oneTestItem = new Content { ContentPath = "questions/tagged/excel", ContentTitle = "any text" }; 
     forExample.Add(oneTestItem); 

     for (int i = 0; i < forExample.Count; i++) 
     { 
      ws.Cells[1, 2] = "any text"; 

      int range1 = i + 4; 
      var range = ws.get_Range("C" + range1, "C" + range1); 

      Microsoft.Office.Interop.Excel.Hyperlink link = (Microsoft.Office.Interop.Excel.Hyperlink) 
      ws.Hyperlinks.Add(range, "http://stackoverflow.com/" + forExample[i].ContentPath, Type.Missing, 
           "Any Tooltip text!!!! e.g(http/://stackoverflow.com/forExample[i].ContentPath)", 
           forExample[i].ContentTitle); 
     } 
    } 

class Content 
{ 
    /// <summary> 
    /// That is a Content Title (e.g: oneArticle) 
    /// </summary> 
    public string ContentTitle { get; set; } 

    /// <summary> 
    /// That is a Content link (e.g: http://stackoverflow/questions) 
    /// </summary> 
    public string ContentPath { get; set; } 
} 
相關問題