Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro or technique to delete cr/lf

Status
Not open for further replies.

p3aul

Instructor
Jul 17, 2004
16
US
I have text documents that have Cr at the end of each sentence and seems to be double-spaced. I can't get the replace dialog box to search for a paragraft mark or a linefeed. I cant get the format paragraph to remove the double-spacing either. It really wrecks havoc trying to convert these texts to an ebook format. I wonder if there is a macro that would strip these cr from the text leaving a cr/lf at the end of each paragraph. If not a macro then a way to use find/replace to do it.
Thanks,
Paul
 
I presume you are asking about Word, but you don't say what version.

There are (at least) two things to do:

1. Determine what is causing the apparent double spacing. I mention this quite deliberately because it may be built in paragraph spacing if you're using Word 2007 (or using any version if the creator has set it up that way). Press Ctrl+Shift+* to display paragraph marks to identify if there are blank paragraphs or not.

If there are blank paragraphs (which seems likely if you can't effect changes with paragraph formatting) you can do a Find for two consecutive paragraph marks and replace each occurrence with one - but beware if you have Word 2007 and any in-line graphics because of a serious bug in this kind of Replace operation.

2. Understand what you have and what you want. You don't seem to know how CR and LF characters are, or are not, used in Word. You may have paragraph marks (which are shown as pilcrows, and marked behind the scenes as CR characters) or you may have manual line break characters (which are shown by a sort of left facing arrow, and marked behind the scenes as VT characters). You do not have, and do not want, linefeed characters; you may want paragraph marks.

A macro could certainly be written, but not until it is know what the situation is, but it might not be worth the effort for what may well be a single F&R operation.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Sounds to me like a PDF extracted to Word.
In Word, the Search code for a paragraph mark is "^p".

And searching for " " to replace with " " is not rocket science.
:)

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top