Remove text in Word

Hi,

I have this sentence in my word :

  • VAR 1
  • VAR 2
  • VAR 3

How i can remove this 3 sentence ? I use a replace text with “VAR*” in Search fiels but without result

Use instr() function and try to check if “VAR” is available in your string or not.
if Available Instr() will return a value … if not… it will return 0.
Based on this condition you can use replace or skip that string…

@samouuu
Read the Word document and store it in a string stra

String Array ABC= stra.Split({Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)

List B=(From p in ABC
where not p.ToString.Contains(“VAR”)
Select p.ToString).ToList

string OutPut = string.Join(Environment.NewLine,ListB)

Then Write the string in Word.

Regards,
Mahesh

please use .trim() action in code