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.
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
Fine
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
NOT String.IsNullOrEmpty(str_colname.ToString)
If true it will go to THEN apart where we can use a SET RANGE COLOR activity and mention the range as
str_colname+(dt.Rows.IndexOf(row)+2).ToString
And color as System.Drawing.Color.Red
Cheers @sneha_arbole
**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,
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
Cheers @sneha_arbole
Thank You
The key word is not getting highlighted…
Yes i have included that step
Hi @sneha_arbole,
And also you can try the find activity to search the word inside excel.
Regards
Balamurugan.S
Need to search the keyword from one excel file to another.I Used lookup range activity but it is giving the output as a cell reference of that keyword.