Delete empty lines in word document


#1

Hi Developers,
I have a Word file with data and also some empty lines. so i want to delete the empty lines


#2

@saikrishna1 try below codes, both will work

deleteEmptyLinesInTextFile.xaml (9.1 KB)

or

deleteEmptyLinesInTextFile1.xaml (7.3 KB)


#3

@saikrishna1

Use Word Application Scope.
Inside Word Application Scope use Read Text Activity and store it in a string strA.

String[] ABC= strA.Split({"Environment.NewLine"}, StringSplitOptions.RemoveEmptyEntries).ToArray

string b= string.Join("Environment.NewLine",ABC)

Now string b will not contain Empty lines.

Now Use Write Text File or Append Text Activity inside Word Application scope to write string b.

Regards,
Mahesh