How to delete empty page or empty spaces from a word file

Hi All,

Does anyone know how to delete the empty pages or empty spaces (2 or more newlines) from a word document ?.

Kindly requesting your help on this

Thanks and regards
Charith

Buddy @charith_wickramasing

  1. Use word application scope to read the word activities
  2. use read text within that scope and get the output as text type with variable name out_text
  3. use a assign activity to remove all the spaces like this
    out_text_array = out_text.Split({“Environment.NewLine”}, StringSplitOptions.RemoveEmptyEntries).ToArray
  4. then use another assignaciivty
    out_final_text = string.Join(“Environment.NewLine”,out_text_array)
  5. use write range to enter the text to the word without blank line

Hope this would help you buddy
Kindly let know for any queries

Cheers @charith_wickramasing

2 Likes

Thanks a lot buddy, i’ll check and let you know :slight_smile:

1 Like

Hi @charith_wickramasing

I have created workflow based on your requirement run and check it will help you.

DeleteBlankSpaceInWord.zip (21.2 KB)

1 Like

it works buddy, but it deleted the images of my word file as well. this is the word file i’m using

and as you can see in it. thee are some unnecessary spaces and blank pages in it. I want to remove those spaces and pages only.

BTW Thanks a lot for the help :slight_smile:

it works buddy, but it deleted the images of the file as well. this is the file i’m using

as you can see in the file, there are some unnecessary spaces and blank pages in it. i want to remove those things