I want to search for a specific keyword and highlight that keyword. i am unable to find the keyword and highlight it. How do i highlight the keyword? Please help me to resolve the issue.
is that keyword lies in any specific column
Do you want to highlight the keyword alone or the whole cell where the keyword is available?
yes it lies in specific column,but i dont know the which column it lies i need to search it.
I want to highlight the keyword alone
Hope these steps would help you resolve this
—use a excel application scope and pass the file path as input
—inside the scope use read range activity and get the output with a variable of type datatable named dt
—now use a for each row activity and pass the variable dt as input
—inside the loop use a assign activity like this
str_colname = IF(row.ItemArray.ToList.IndexOf(“your keyword”) > 0, Convert.ToChar(row.ItemArray.ToList.IndexOf(“your keyword”)+65).ToString,String.Empty)
Where str_colname is a string variable with default value as string.empty
—then next to this use a IF condition like this
If true it will go to THEN apart where we can use a SET RANGE COLOR activity and mention the range as
And color as System.Drawing.Color.Red
**str_colname = IF(row.ItemArray.ToList.IndexOf(“your keyword”) > 0, Convert.ToChar(row.ItemArray.ToList.IndexOf(“your keyword”)+65).ToString,String.Empty)
I did not understand, why you taken 0 and 65. Can you please elaborate it,
In excel you can not highlight a word alone in a cell.
if there is no keyword in a row, it will give index as -1 so have set a condition should be more than 0
and if so it will get the index of the column and gets added with 65 because 65 ascii code is A
which is then added with row index +2 to find the cell position like A2 , or A3…like that
The key word is not getting highlighted…
Did that step included
Yes i have included that step
And also you can try the find activity to search the word inside excel.