public static int GetRowIndexByColValue(this HtmlTable @this, int colIndex, string colValue) { for (int index = 0; index < @this.RowCount; index++) { string cellValue = @this.GetCellByIndex(index, colIndex).InnerText; if (colValue.Equals(cellValue, StringComparison.CurrentCultureIgnoreCase)) { return(index); } } return(0); }
public static int GetFirstCellIndexMatchedValue(this HtmlTable @this, string expectedCellValue, params Int32[] startRowIndex) { int startrow = 0; int retVal = 0; string actual = ""; if (startRowIndex != null) { startrow = startRowIndex[0]; } for (int rowIndex = startrow; rowIndex < @this.RowCount; rowIndex++) { for (int colIndex = 0; colIndex < @this.ColumnCount; colIndex++) { actual = @this.GetCellByIndex(rowIndex, colIndex).InnerText; if (expectedCellValue.Equals(actual, StringComparison.CurrentCultureIgnoreCase)) { retVal = rowIndex * 10 + colIndex; return(retVal); } } } return(retVal); }