2

如何使用电子表格齿轮中的文本从标题中查找列位置?

即想从SpreadSheet 中找到Remark Text ColumnPosition。 在此处输入图像描述

4

2 回答 2

1

得到的结果如下。

SpreadsheetGear.IRange range = workbookView.ActiveWorksheet.Cells.Find("StringtoFind", null, SpreadsheetGear.FindLookIn.Values, SpreadsheetGear.LookAt.Part, SpreadsheetGear.SearchOrder.ByRows, SpreadsheetGear.SearchDirection.Next, true);

谢谢..

于 2013-11-28T07:09:57.230 回答
0

您可以遍历标题行中的列,直到找到匹配的文本。

//Get the cells of a worksheet
SpreadsheetGear.IRange cells = worksheet.Cells;

int iColRemark = 0;
//loop through columns
for (int iCol = 0; iCol < cells.ColumnCount; iCol++)
{
  //check header row for colummn that has the text 'Remark'
  if (cells[0, iCol].Text.Equals("Remark"))
  {
    iColRemark = iCol;
    break;
  }
}
于 2013-11-27T14:40:12.807 回答