/// <summary>
/// 查找重复项
/// </summary>
/// <param name="control"></param>
public void FindRepeat(IRibbonControl control)
{
Excel.Application app = ExcelDnaUtil.Application as Excel.Application;
if (!Information.TypeName(app.Selection).Equals("Range"))
return;
Excel.Range rngSelection = app.Selection;
HashSet<int> colNums = new HashSet<int>();
foreach (Excel.Range item in rngSelection.Areas)
{
colNums.Add(item.Column);
}
List<int> colNumList = new List<int>(colNums); colNumList.Sort();
//string msg = string.Format("{0}",string.Join("/", colNumList.ToArray()));
//MessageBox.Show(msg);
string msg = string.Empty;
MyAided myAided = new MyAided(app.ActiveSheet as Excel.Worksheet);
if (1 == colNumList.Count)
{
msg = myAided.FindRepeat();
}
else
{
msg = myAided.FindRepeat(colNumList.ToArray());
}
if (!string.IsNullOrEmpty(msg))
{
MessageBox.Show(msg, "重复项", MessageBoxButtons.OK);
MyCommon.WriteLog(msg, "d:\\Log", true);
}
}