Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在电子表格设备中按文本查找列位置?_C#_Spreadsheetgear - Fatal编程技术网

C# 如何在电子表格设备中按文本查找列位置?

C# 如何在电子表格设备中按文本查找列位置?,c#,spreadsheetgear,C#,Spreadsheetgear,如何使用电子表格中的文本从标题中查找列位置 i、 e要从电子表格中查找备注文本列位置。 您可以循环浏览标题行中的列,直到找到匹配的文本 //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++) {

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

i、 e要从电子表格中查找备注文本列位置。

您可以循环浏览标题行中的列,直到找到匹配的文本

//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;
  }
}
//获取工作表的单元格
SpreadsheetGear.IRange单元格=工作表.cells;
int iColRemark=0;
//循环通过列
对于(int-iCol=0;iCol
得到的结果如下

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