How to find Column Position from Header by using text in Spreadsheet Gear?
i.e want to find Remark Text ColumnPosition From SpreadSheet.
How to find Column Position from Header by using text in Spreadsheet Gear?
i.e want to find Remark Text ColumnPosition From SpreadSheet.
Got the result is as below.
SpreadsheetGear.IRange range = workbookView.ActiveWorksheet.Cells.Find("StringtoFind", null, SpreadsheetGear.FindLookIn.Values, SpreadsheetGear.LookAt.Part, SpreadsheetGear.SearchOrder.ByRows, SpreadsheetGear.SearchDirection.Next, true);
Thanks..
You could loop though the columns in the header row until you find your text match.
//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;
}
}