private bool FindWithinRow(SearchInfo info, int rowIndex, int startAtColumnIndex = 0) { for (var j = startAtColumnIndex; j < Columns.Count; j++) { if (rowIndex == info.StartRowIndex && j == info.StartColumnIndex) { info.Finished = true; } if (info.FieldIndex != -1 && j != info.FieldIndex) { continue; // it's wrong column } if (!this[j, rowIndex].Visible || this[j, rowIndex].Value == null) { continue; } try { var cellValue = this[j, rowIndex].Value.ToString(); if (info.Match(cellValue)) { info.Count++; _ignoreCurrentCellChange = true; CurrentCell = this[j, rowIndex]; _ignoreCurrentCellChange = false; return(true); } } catch { } if (info.Finished) { return(false); } } return(false); }
private bool ReplaceCellValue(SearchInfo info, int colIndex, int rowIndex) { try { var cellValue = this[colIndex, rowIndex].Value.ToString(); if (!info.Match(cellValue)) { return(false); } var options = info.CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase; this[colIndex, rowIndex].Value = Regex.Replace(cellValue, info.Token, info.ReplaceWith, options); return(true); } catch (Exception ex) { Logger.Current.Error("Failed to replace value in table editor.", ex); } return(false); }