Text formatting in Word

For general computer discussion & help, come here

Moderators: Bakhtosh, EvilHomer3k

Post Reply
User avatar
Bakhtosh
Forum Moderator
Posts: 10900
Joined: Wed Oct 13, 2004 12:24 pm
Location: The First Avenger
Contact:

Text formatting in Word

Post by Bakhtosh »

I want to highlight a section of text and remove all of the CRs.

Example before:
The original text is
like this. It is all
broken up and doesn't
fill up the entire width
of the line.

Example after:
The original text is like this. It is all broken up and doesn't fill up the entire width of the line.

I don't want to do it to the whole document, just a highlighted paragraph. Any clues?
“I prefer dangerous freedom over peaceful slavery.” -Thomas Jefferson
Finding Red Riding Hood well-armed, the wolf calls for more gun control.
User avatar
LawBeefaroni
Forum Moderator
Posts: 56570
Joined: Fri Oct 15, 2004 3:08 pm
Location: Urbs in Horto, bonded and licensed.

Post by LawBeefaroni »

Find and replace. There's an option for special characters.

I think you want Paragraph Mark.

Edit: Or manual line break.
" Hey OP, listen to my advice alright." -Tha General
"“I like taking the guns early...to go to court would have taken a long time. So you could do exactly what you’re saying, but take the guns first, go through due process second.” -President Donald Trump.
"...To guard, protect, and maintain his liberty, the freedman should have the ballot; that the liberties of the American people were dependent upon the Ballot-box, the Jury-box, and the Cartridge-box, that without these no class of people could live and flourish in this country." - Frederick Douglass

MYT
User avatar
Bakhtosh
Forum Moderator
Posts: 10900
Joined: Wed Oct 13, 2004 12:24 pm
Location: The First Avenger
Contact:

Post by Bakhtosh »

of course, as soon as I ask I find it.

For those who want to know, highlight the section you want to work in.
Go to the find/replace window (Ctrl-F or Edit, Replace). If you don't see the button, "Special", click on "More" then click on "Special". Choose the paragraph mark and replace it with nothing. Then click on replace all and say no when it asks if you want to do the whole document.
“I prefer dangerous freedom over peaceful slavery.” -Thomas Jefferson
Finding Red Riding Hood well-armed, the wolf calls for more gun control.
User avatar
Bakhtosh
Forum Moderator
Posts: 10900
Joined: Wed Oct 13, 2004 12:24 pm
Location: The First Avenger
Contact:

Post by Bakhtosh »

Okay...this isn't working. Let's be more specific...

I have a plain text file that I want to print. The problem is that I want to print it, saving as much paper as possible. To do this, I typically reduce the font size and print it booklet style. When I open the document in Word, and show paragraph marks, there's one at the end of every line, which leaves a lot of white space at the end of the line once it's reduced.

I want to get rid of the marks except the ones behind a period or that are on a line by themselves.

In Word, I can search for ^$^p and that will find any paragraph mark that's preceded by any letter, but when I replace that with a space or nothing, it also deletes the last letter of the line...not good.

So I need some kind of conditional formatting command that can run a function.
if char == ^p [paragraph mark] and prev_char == ^$ [any letter] then char = ^s [space]
“I prefer dangerous freedom over peaceful slavery.” -Thomas Jefferson
Finding Red Riding Hood well-armed, the wolf calls for more gun control.
User avatar
LawBeefaroni
Forum Moderator
Posts: 56570
Joined: Fri Oct 15, 2004 3:08 pm
Location: Urbs in Horto, bonded and licensed.

Post by LawBeefaroni »

Did you try manual line break (^l)?

I think it works on end of line regardless of the last character in the line. You can try replacing it with nothing (replace with null) but you might get words that run together. I'd just replace it with a space. Worst case, you get words with two spaces between them.

You can then do a find/replace for double spaces I guess.

It should keep paragraphs separate as well as single lines.
" Hey OP, listen to my advice alright." -Tha General
"“I like taking the guns early...to go to court would have taken a long time. So you could do exactly what you’re saying, but take the guns first, go through due process second.” -President Donald Trump.
"...To guard, protect, and maintain his liberty, the freedman should have the ballot; that the liberties of the American people were dependent upon the Ballot-box, the Jury-box, and the Cartridge-box, that without these no class of people could live and flourish in this country." - Frederick Douglass

MYT
User avatar
Freezer-TPF-
Posts: 12698
Joined: Wed Oct 13, 2004 2:41 pm
Location: VA

Post by Freezer-TPF- »

If it's just a plain .txt file, you can use a good text editor like Notetab Light (freeware) to join the lines and remove the unwanted hard returns.
When the sun goes out, we'll have eight minutes to live.
User avatar
Grundbegriff
Posts: 22277
Joined: Wed Oct 13, 2004 3:46 am
Location: http://baroquepotion.com
Contact:

Post by Grundbegriff »

Bakhtosh wrote:I want to get rid of the marks except the ones behind a period or that are on a line by themselves.
Here's what I do to preserve the ^p's that separate paragraphs while eliminating the ones that force a line feed:

First, search for ^p^p and replace it with @@@ (or some other memorable string that doesn't occur in the text itself).

Second, search for ^p and replace it with a single space.

Third, search for @@@ and replace it with ^p^p. That'll put your paragraph structure back in place.
User avatar
is_dead
Posts: 202
Joined: Mon Oct 25, 2004 7:07 pm
Location: Toronto

Post by is_dead »

If it was me, I'd enjoy the excuse to try and figure out a word VBA macro that does it.
is_dead
User avatar
Bakhtosh
Forum Moderator
Posts: 10900
Joined: Wed Oct 13, 2004 12:24 pm
Location: The First Avenger
Contact:

Post by Bakhtosh »

I actually did something like that last night after brainstorming about it at dinner. My method was more complex, so I like yours a lot better.

If I had any experience at VBA scripting, I'd be on this like white on rice, but I've never actually written anything in VBA (despite taking the CBT course in it a few years ago).

Thanks for the critical thinking guys.
“I prefer dangerous freedom over peaceful slavery.” -Thomas Jefferson
Finding Red Riding Hood well-armed, the wolf calls for more gun control.
Post Reply