Trim Spaces in Word File Line by Line

Hi Team ,

Need quick help on trimming spaces in word file.

I am able to trim the spaces ,but i want to trim line by line.

For Trimming I am using code:

String.Join(Environment.NewLine,YourVariable.Split({Environment.NewLine,vbcrlf,vblf," ",vbtab,vbcr,vbNewLine},StringSplitOptions.RemoveEmptyEntries))


ABC 0.00

BCD 0.00

Currently getting ouput as:

ABC 0.00BCD 0.00

I want to display

ABC 0.00
BCD 0.00

Please let me know which part of code need to change.

Appreciate your help @sarathi125 @Shashi123 @Palaniyappan

1 Like

Main.xaml (5.6 KB)
Hope this helps.


Hi @Shashi123,

Awesome ,it works perfect.

Thank you for the solution.

1 Like

Welcome. Happy to help. mark the reply as solution if it helped you.


Stringvariable = String.Join(Environment.Newline,Stringvariable.Split(Environment.Newline.ToArray(),Stringsplitoptions.RemoveEmptyEntries))

Cheers @RajeshT

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.