How to delete row in word document

Hi All

I will have line called “This is Mine” need to remove entire line from the word template pls suggest any one how to fix

Thanks
Venkatareddy.D

@venkatreddy

Can you please share screenshot of that word document and need to check once how its looks in word document.

You can simply use the text.replace activity and replace it with nothing. @venkatreddy

Check this: How to manipulate a part of string: Split, Trim, Substring, Replace, Remove, Left, Right

I need to remove fifth sixth point of this document

Hi @venkatreddy ,

We could try the Following Steps assuming that you would know atleast a distinguished part of the Lines that you need to remove.

  1. Create an Array of String, and Store the Line Indicators, like below :
strLineIndicators = {"This is Mine"}
  1. Next, Using Read Text from UiPath.Word.Activities Package read the Entire Document Text, output to a variable say , wordDocText

  2. We find the Complete lines of the Line Indicators by using the Below Expression :

linesToRemove = Split(wordDocText,Environment.NewLine).Where(Function(x)strLineIndicators.Any(Function(y)x.Contains(y))).ToArray

where linesToRemove is also an Array of String and it holds the matching lines that need to be removed.

  1. Next, using a For Each Activity Iterate through the linesToRemove and inside For Each use Replace Text in Document Activity
  • In the Search for field pass the item from For Each
  • In the Replace with, we can pass an Empty String.

This Should do the required operation, provided we ae able to find the Lines based on the Indicators properly.

Let us know if you are facing any difficulties.