Does anybody know a way to remove all blank pages from a Word document. An empty page is a page that contains only the ---page break -- and the --enter-- charater. Any code-snippet would be great
Printable View
Does anybody know a way to remove all blank pages from a Word document. An empty page is a page that contains only the ---page break -- and the --enter-- charater. Any code-snippet would be great
I assume you mean that this is YOUR spec for an empty page. In general an empty page does not have an enter char, it's just two contiguous page break tokens.Quote:
An empty page is a page that contains only the ---page break -- and the --enter-- charater
On the other hand, if you're talking about a page that LOOKS empty, then it could have any combination of space chars, tabs, enter chars and possible other non-printing characters in between two page break tokes, so unless you are sure that YOUR empty pages are exactly one enter char between page break tokens, you'll need to be careful how you do this.
You correct, I have 2 be more specific: How do I remove all pages from a word document that LOOK empty???
pseudo code
isolate one page worth of text into a temporary string
use "replace" to get rid of all blanks, CR's, LF's, tabs, etc
see if string is now empty
on empty string, delete one page break token
have fun.