Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-06-2011, 05:11 AM
Bobosmite Bobosmite is offline Need help editing a .PDF to .DOC conversion Windows 7 Need help editing a .PDF to .DOC conversion Office 2003
Advanced Beginner
Need help editing a .PDF to .DOC conversion
 
Join Date: May 2010
Posts: 47
Bobosmite is on a distinguished road
Default Need help editing a .PDF to .DOC conversion

I've been doing this for a while now and this one has me stuck for a Find/Replace solution. I'm not so good at using Find/Replace wildcards, so I'm hoping someone can help.



The PDF converter added a new paragraph in the middle of many quotations. Looking at the source document, it can't be helped due to how the text falls on the line.


This is how it looks in the .PDF:

"...all they want is to sit in the seats of the mighty and lord it over everyone else.∙^p

The intellectual aristocrats!"∙^p


This is how it converts to Word:

https://picasaweb.google.com/lh/phot...eat=directlink

Is there a way to use wildcards to find this in my document? Eyballing just doesn't cut it.
Reply With Quote
  #2  
Old 05-06-2011, 05:18 AM
macropod's Avatar
macropod macropod is offline Need help editing a .PDF to .DOC conversion Windows 7 32bit Need help editing a .PDF to .DOC conversion Office 2007
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 Bobosmite,

When you paste text from a PDF, web site or an email, you may end up with a paragraph break at the end of every line within a logical paragraph, and two such breaks between logical paragraphs.

The following macro cleans up text pasted from emails, websites, etc, that insert paragraph breaks at the end of every line. Note that the code assumes there are at least two such paragraph breaks between the 'real' paragraphs.
Code:
Sub CleanUpPastedText()
'Turn Off Screen Updating
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Wrap = wdFindStop
  .Format = False
  .MatchAllWordForms = False
  .MatchSoundsLike = False
  .MatchWildcards = True
  'Eliminate spaces & tabs before paragraph breaks.
  .Text = "[ ^s^t]{1,}^13"
  .Replacement.Text = "^p"
  .Execute Replace:=wdReplaceAll
  'Replace single paragraph breaks with a space
  .Text = "([!^13])([^13])([!^13])"
  .Replacement.Text = "\1 \3"
  'Replace all double spaces with single spaces
  .Execute Replace:=wdReplaceAll
  .Text = "[ ]{2,}"
  .Replacement.Text = " "
  'Delete hypens in hyphenated text formerly split across lines
  .Execute Replace:=wdReplaceAll
  .Text = "([a-z])-[ ]{1,}([a-z])"
  .Replacement.Text = "\1\2"
  .Execute Replace:=wdReplaceAll
  'Limit paragraph breaks to one per 'real' paragraph.
  .Text = "[^13]{1,}"
  .Replacement.Text = "^p"
  .Execute Replace:=wdReplaceAll
End With
'Restore Screen Updating
Application.ScreenUpdating = True
End Sub
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html

If you'd prefer to run the macro against just a selected range, change:
ActiveDocument
to:
Selection
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help editing a .PDF to .DOC conversion pdf to word conversion wordpdf Word 3 05-15-2011 01:58 PM
Pdf conversion from word 2000 moniele Word 0 10-20-2010 10:23 AM
Unwanted image conversion happens in .pdf rec Drawing and Graphics 0 07-15-2010 07:34 AM
Need help editing a .PDF to .DOC conversion Auto Shape Conversion Launchnet Excel 1 04-18-2006 06:25 AM
Need help editing a .PDF to .DOC conversion Specific Lat Long Conversion Help chesspupil Excel 2 04-16-2006 11:06 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:32 AM.


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