Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2011, 08:58 PM
sparemejava sparemejava is offline How to ensure that each line ends only at the margin Windows XP How to ensure that each line ends only at the margin Office 2007
Novice
How to ensure that each line ends only at the margin
 
Join Date: Feb 2011
Posts: 1
sparemejava is on a distinguished road
Default How to ensure that each line ends only at the margin

Hi All,

I copied a page from a pdf, document to word 2007, but not every line ends at the same position (at the margin). I can do a manual fix, but I have a quite a bunch of files to be copied. So, I was wondering, if there is any option in word 2007, to format the content, such that each line ends at same position.

For eg,

If I copy the content from PDF, it is coming as below

rebranded and CORBA has diminished in popularity. Although EJB currently has a lead over its rivals,
they are forever nipping at its heels. CORBA has actually evolved a very similar but somewhat




but what I wanted to have here is
rebranded and CORBA has diminished in popularity. Although EJB currently has a lead over its rivals, they are forever nipping at its heels. CORBA has actually evolved a very similar but somewhat

Can some body help me in this ?
Reply With Quote
  #2  
Old 02-01-2011, 09:12 PM
macropod's Avatar
macropod macropod is offline How to ensure that each line ends only at the margin Windows 7 32bit How to ensure that each line ends only at the margin Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi sparemejava,

Your problem description suggests the copied text has come though with paragraph breaks at the end of each line (and probably two paragraph or more breaks between logical paragraphs). You can fix this using a series of wildcard Find/Replace actions, with:
Find = ([!^13])([^13])([!^13])
Replace = \1 \3
Find = ([ ])[ ]{1,}
Replace = \1
Find = [^13]{2,}
Replace = ^p
Find = [ ^13]
Replace = ^p
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-03-2011, 12:24 AM
WaltR WaltR is offline Windows Vista Office 2007
Competent Performer
 
Join Date: Dec 2010
Posts: 123
WaltR is on a distinguished road
Default

Pasting from PDFs can be a real pain. I don't think Word 2007 has an easy fix for it. I haven't figured out how to use wildcards yet, but you can make your life a lot easier with a few Replace steps.

You want to get rid of the paragraph breaks you don't want while keeping the ones you do. The ones you want to keep are at the end of the paragraph and will include some punctuation mark, usually a period, an exclamation point, sometimes a parenthesis, or whatever. First you want to mark those with a unique descriptor like aaa. So you replace .P, or !P or "P with .aaa, or !aaa, or "aaa. These are the good ones. Then you replace all the other paragraph marks with nothing (just leave the "Replace with" box empty). Then go back and replace aaa (don't replace the period, just aaa) with ^p^p (two paragraph marks) and you're done.

Sometimes the punctuation at the end of sentences is followed by a space, so you put . P in the "Replace" box. You have to be aware of little things like that.

This isn't 100% foolproof. You'll still have to do some manual editing but compared to the alternative it's a cake walk. Or you can learn wildcards (might be easier).
Reply With Quote
  #4  
Old 02-03-2011, 03:14 AM
macropod's Avatar
macropod macropod is offline How to ensure that each line ends only at the margin Windows 7 32bit How to ensure that each line ends only at the margin Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Walt,

Telling Word to use wildcards is as easy as checking the 'use wildcards' options on the (expanded - click More) Find/Replace dialogue box. The tricky part is in learning how to encode the Find/Replace expressions. The four I gave in my previous post, though fairly simple, give a hint of what can be done.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-04-2011, 12:13 PM
Ulodesk Ulodesk is offline How to ensure that each line ends only at the margin Windows 7 How to ensure that each line ends only at the margin Office 2007
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default Replace with nothing?

Walt,
Are you certain? I have sometimes run into trouble this way, with Word then running together the last word on a line with the first on the next. when I record a macro to do this kind of operation, I have found it necessary, usually, to replace the single paragraph with a single space.
Reply With Quote
  #6  
Old 02-06-2011, 12:38 AM
WaltR WaltR is offline Windows Vista Office 2007
Competent Performer
 
Join Date: Dec 2010
Posts: 123
WaltR is on a distinguished road
Default

Hi Ulodesk. You're right, thanks for mentioning that. Sometimes it's necessary in that step to replace with a space, though not always. I've seen it both ways.

I never do a whole document at once. Usually I do a few paragraphs at the beginning until I see how it's going. As I get more comfortable I'll do larger sections at a time but it's still a good idea to keep checking. I've seen some documents change several times.
Reply With Quote
  #7  
Old 02-06-2011, 05:15 AM
macropod's Avatar
macropod macropod is offline How to ensure that each line ends only at the margin Windows 7 32bit How to ensure that each line ends only at the margin Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Ulodesk View Post
Walt,
Are you certain? I have sometimes run into trouble this way, with Word then running together the last word on a line with the first on the next. when I record a macro to do this kind of operation, I have found it necessary, usually, to replace the single paragraph with a single space.
Hi Ulodesk,

The wildcard Find/Replace sequence I posted takes care of the space issues. Here's how it works:
Find = ([!^13])([^13])([!^13])
Finds any paragraph break that's has a character other than a paragraph break both before and after it. The three sets of parentheses tell Word that the Find expression has three components we want to keep track of.
Replace = \1 \3
Replaces the found paragraph break with a space, keeping the characters before and after. The \1 and \3 correspond with the first and third parentheses from the Find expression.
Find = ([ ])[ ]{1,}
Find a space character followed by one or more additional space characters. The {1,} tells Word that the preceding expression applies to one or more characters.
Replace = \1
Keeps the first space only.
Find = [^13]{2,}
Find any two or more paragraph breaks (note: we can't use ^p in a wildcard Find).
Replace = ^p
Replace with only a single paragraph break (note: using ^13 in a wildcard Replace doesn't create proper paragraph breaks - just line breaks that look like them).
Find = [ ^13]
Find any paragraph break preceded by a space.
Replace = ^p
Replace with only the paragraph break.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 02-06-2011, 11:08 AM
Kimberly Kimberly is offline How to ensure that each line ends only at the margin Windows 7 How to ensure that each line ends only at the margin Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

I just turn on Show/Hide and see what character is causing the problem and then use Replace to fix it.

Sometimes it's a paragraph mark and I have to first replace 2 paragraph marks that are together with zzz, and then replace paragraph marks, and then replace zzz with a paragraph mark.
Reply With Quote
  #9  
Old 02-06-2011, 12:43 PM
macropod's Avatar
macropod macropod is offline How to ensure that each line ends only at the margin Windows 7 32bit How to ensure that each line ends only at the margin Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Kimberly,

In some copy/pasted material, you'll find more than two paragraph breaks between logical paragraphs, so you might still end up with unwanted paragraph breaks.

In your second step, simply deleting the paragraph marks can result in consecutive words either side of the paragraph mark being run together. Conversely, if you replace them with spaces, you'll sometimes end up with double spaces between the consecutive words.

It all depends on what's in the copy/pasted passage - and the mix can vary within the passage. The Find/Replace sequence I posted takes care of any of these combinations and works whether the passage was copy/pasted from a PDF, an email or a web page.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #10  
Old 02-06-2011, 03:21 PM
Kimberly Kimberly is offline How to ensure that each line ends only at the margin Windows 7 How to ensure that each line ends only at the margin Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

I always turn on Show/Hide and make decisions... if there are multiple paragraph marks, I address that, as well as whether to replace with spaces or not. So far I haven't run across any where the mix varied within the passage. Of course if I do, I'll be looking for the sequence you posted.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Margin-less/Borderless Printing tmndi Word 2 08-13-2011 12:48 AM
How to ensure that each line ends only at the margin Margin 'above' footer text? markg2 Word 2 12-28-2010 05:50 PM
Margin Error ??? velohead Word 3 08-10-2010 06:18 AM
Word Minimum Margin rangeshram Word 0 09-24-2008 01:38 AM
top margin - different first page beanz Word 0 06-28-2006 06:32 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft