如何使用Spreadsheet Gear中的文本从标题中找到列位置?
即想从SpreadSheet中找到备注文本ColumnPosition。
答案 0 :(得分:1)
得到的结果如下。
SpreadsheetGear.IRange range = workbookView.ActiveWorksheet.Cells.Find("StringtoFind", null, SpreadsheetGear.FindLookIn.Values, SpreadsheetGear.LookAt.Part, SpreadsheetGear.SearchOrder.ByRows, SpreadsheetGear.SearchDirection.Next, true);
谢谢..
答案 1 :(得分: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;
}
}