本文介绍了Excel工作表中的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个名为"ls"的列表中有一些胎儿血管名称.我需要在Excel工作表中填充这些值,并为每个值创建超链接.
这些胎儿血管名称将动态加载到每个患者的列表中.
我的问题是,当我单击任何船只的超链接时,最后一个超链接正在打开.
我正在使用Windows窗体.
这是我的代码-

I have some Fetal Vessel names in a list called "ls". I need to populate those values in an excel sheet and create hyperlink for each of them.
These Fetal vessel names are loaded dynamically to the list for each patient.
My problem is when i click on any vessel''s hyperlink, the last hyperlink is opening.
am using windows form.
here is my code -

//------------Creating drop down for the values of list--------------
    string list = string.Join(",", ls.ToArray());
    range.Validation.Delete();
    range.Validation.Add(XlDVType.xlValidateList, XlDVAlertStyle.xlValidAlertInformation, XlFormattConditionOperator.xlBetween, list, Type.Missing);
    range.Validation.IgnoreBlank = true;
    range.Validation.InCellDropdown = true;
//---------------looping through each value and creating hyperlink----------
    foreach (object lst in ls)
    {
        Microsoft.Office.Interop.Excel.Hyperlink hyperlink = (Microsoft.Office.Interop.Excel.Hyperlink)range.Hyperlinks.Add(range, "P:\\"+ PID.Text.ToString() + "\\"+ lst.ToString() + ".avi",Type.Missing, Type.Missing, "" + lst.ToString() + "");
    }

推荐答案



这篇关于Excel工作表中的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 08:11