Extracting a URL from hyperlinked text in Excel cell

前端 未结 8 2228
孤街浪徒
孤街浪徒 2020-12-17 23:43

I have a table full of Hyperlinked text in excel, so it\'s basically a bunch of names but when I click on one, it takes me to some URL in my default browser.

So I am

8条回答
  •  囚心锁ツ
    2020-12-18 00:13

    Try this:

    Excel.Application appExcel = new Excel.Application();
    Excel.Workbooks workBooks = appExcel.Workbooks;
    Excel.Workbook excelSheet = workBooks.Open("......EditPath", false, ReadOnly: true);
    
    foreach (Excel.Worksheet worksheet in excelSheet.Worksheets)
    {
        Excel.Hyperlinks hyperLinks = worksheet.Hyperlinks;
        foreach (Excel.Hyperlink lin in hyperLinks)
        {
            System.Diagnostics.Debug.WriteLine("# LINK: adress:" + lin.Address);
        }
    }
    

提交回复
热议问题