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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing blank lines

Status
Not open for further replies.

normap

MIS
Apr 20, 2001
94
CA
Does anyone know how to automatically remove blank lines from a print file or a Word document?
 
In programs like Word 2000, there are options for spacing suppression. In woed 2000 for example it is under tools/options/compatibility.
Hope this helps. If not please post back.
 
Changing the compatibility in Word 2000 didn't remove the blank lines. In front of every line that has text on it there is a square box. The just below that line is the blank one. This spreads the information down the page too far and if all the blank lines are removed it puts everything in the proper spot.:cool:
 
In the Format/ paragraph menu there is a section for setting line spacing. The setting should be single.
 
Yes I have tried that as well. I have downloaded a demo of Textpipe software that will remove the blank lines but it is very expensive and must be used before it gets into Word. Makes it a 3 step operation and a lot of work
::)
 
Not sure what version of Word you're using, but look in EDIT, REPLACE, and click on FIND "SPECIAL" button. One of those special characters maybe the one you want. Use a "space" or nothing at all to replace with, and then hit the "REPLACE ALL" button. Suggest you try it on a copy of the file first!

Good luck!

ROGER - GØAOZ.
 
The special character list doesn't include the one that is at the beginning of each line. I have tried everything in the search and replace but I either remove all blank spaces or none. This is a real puzzle. If anyone else has any ideas please let me know. Right now I am willing to try just about anything

*:->*
 
Have you tried copying and pasting the character via the Windows shortcut keys Copy - Ctrl + c and Paste - Ctrl + v

I don't think the normal right click works in this instance. Just a thought.
 
The windows shortcut keys will not copy and paste the character into the find and replace. Thanks anyways :-V
 
Hello, huronbay.

First, if only you can give the forum a bit more impetus as to the motivation/reason for the task proposed. How many files are we talking about? What other characteristics are there in the files relevant to or might interfere with the task?

Second, you want it done on word.doc or print file ?

regards - tsuji
 
I get 2 print files daily from our supplier. They are meant to be printed on laser printers and are laden with PCL font information at the beginning of the file. It is the line below in one file that I would like to insert a page break and a company name at and remove it -
&f1Y&f2X(8U(s0p16.66h8.5v0s0b0T&l6C&a0C&a0R

The PCL font information at the beginning of the file I can remove myself. I am importing these files into Word 2000 to make it easier for the rest of the company to print. They only have either inkjet printers or dot matrix printers at their location, which don't support PCL fonts.

The other file has the following line that I would like to remove the blank lines from: this is a sample of how it looks in Word 20




454








HURON BAY COOPERATIVE INC HURON BAY COOPERATIVE INC


09/13/01 65307370400 BROWN STREET 11 FIRST AVE


BOX 39




As you can see there is a lot of blank lines, as well at the beginning of the lines that have text there is a square box which didn't show up in the copy and paste. I can format the page width but it is the blank line between that I can't get rid of

The other option I have is to find something that would convert the PCL fonts to something that an inkjet or dotmatrix printer could read.
 
Hello again.

Thank you for the info. I'm not sure on the PCL format file specs. If I know the detail of it, I or somebody else might be able to propose something.

As to the word.doc, I do not see yet very well the big picture of your files. In any case, I can provide you with a script for Eliminating All Empty Paragraphs (hence, a special kind of empty lines) in your word documents.

The script below functions as follows.
[1] Use highlight-copy-paste to paste it to a plain text file. Name the file to, say,:
ShrinkEmptyParagaphs.vbs
(Extension .vbs is a rigid requirement.)
[2] Put it in any folder you like.
[3] In explorer, use mouse key to drag the icon of one of your .doc word document you want to eliminate empty lines and drop the icon on top of the file ShrinkEmptyParagraphs.vbs.
[4] By doing so, a new file will be created in your original doc folder with the new of that doc file only with a underscore in front as prefix. The output file is having the desired effect.

Use some trial doc file and see the effect of it.

regards - tsuji

'----------ShrinkEmptyParagraphs.vbs----/tsuji/---
Option Explicit

Const prefix = "_"
Dim oArgs, filename, newfilename, pos, i
Set oArgs = WScript.Arguments
If oArgs.Count = 0 Then
WScript.Echo "This script requires a drag-and-drop arguments." & vbCrLf & _
"No argument is present. Operation is aborted."
Set oArgs = Nothing
WScript.Quit(1)
End If
For i =0 to oArgs.Count - 1
filename = oArgs.Item(i)
If Mid(filename, len(filename)-3, len(filename)) <> &quot;.doc&quot; Then
WScript.Echo &quot;This argument must be a <.doc>MS Word document.&quot; & _
vbCrLf & &quot;Operation is aborted.&quot;
Set oArgs = Nothing
WScript.Quit(2)
End If
pos = InStrRev(filename, &quot;\&quot;)
newfilename = Mid(filename, 1, pos) & prefix & Mid(filename, pos + 1, len(filename))
call MergeEmptyParagraphs(filename, newfilename)
Next

WScript.Quit

Sub MergeEmptyParagraphs(strFile, strFileSaveAs)

Dim app
Set app = CreateObject(&quot;Word.Application&quot;)
app.Visible=False
app.Documents.Open(strFile)
app.Selection.WholeStory
app.Selection.Find.ClearFormatting
app.Selection.Find.Replacement.ClearFormatting
With app.Selection.Find
.Text = &quot;^p&quot;
.Replacement.Text = &quot;XXX&YYY&ZZZ^p&quot;
.Forward = True
.Wrap = False
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
app.Selection.Find.Execute , , , , , , , , , , 2
With app.Selection.Find
.Text = &quot;^pXXX&YYY&ZZZ&quot;
.Replacement.Text = &quot;&quot;
End With
app.Selection.Find.Execute , , , , , , , , , , 2
With app.Selection.Find
.Text = &quot;XXX&YYY&ZZZ&quot;
.Replacement.Text = &quot;&quot;
End With
app.Selection.Find.Execute , , , , , , , , , , 2

app.Documents(1).SaveAs strFileSaveAs
app.Documents.Close
app.Quit

Set app = Nothing
End Sub
'----------ShrinkEmptyParagraphs.vbs----/tsuji/---

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top