Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2011, 11:30 AM
Metamag Metamag is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 64bit
Novice
automatic text formatting(justify)
 
Join Date: Apr 2011
Posts: 23
Metamag is on a distinguished road
Default automatic text formatting(justify)

Often when you copy and paste certain texts from internet to office document and then click all the text and justify it(align text to both left and right side margins) it makes no difference at all, like you didn't click justify at all.



I was wondering:

1.Why this happens?
2.How can you fix this automatically instead of manually?
Obviously if you do it manually it is extremely time consuming, you would have to press delete on empty space to get the next line, then click on the end of the line, press delete again and so on, it is grueling beyond belief.

There must be an elegant way to do this instead of that...

P.S.
Also I was wondering if anyone knows of a freeware software that automatically merges multiple html pages into one and/or converts that page into text document?
Reply With Quote
  #2  
Old 04-13-2011, 01:50 PM
Metamag Metamag is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 64bit
Novice
automatic text formatting(justify)
 
Join Date: Apr 2011
Posts: 23
Metamag is on a distinguished road
Default

Can you at least point me to a forum where I might find out the solution to this. Just tell me if this forum is dead?
Reply With Quote
  #3  
Old 04-13-2011, 02:29 PM
BrazzellMarketing BrazzellMarketing is offline automatic text formatting(justify) Windows XP automatic text formatting(justify) Office 2007
Competent Performer
 
Join Date: Apr 2010
Location: Galax, VA
Posts: 120
BrazzellMarketing is on a distinguished road
Default

When you copy and paste from one application to another, many unseen formatting commands are potentially pasted with your text. This can be particularly problematic when copying from the web to Word, because Word will respond to several formatting commands that don't necessarily show up in Word's formatting options (in other words, you can't easily change the formatting that gets carried over).

Word has a simple fix for this. After copying your text from the internet, toggle to Word. In the Home menu, click the down arrow beneath the paste icon (far left of the ribbon menu in 2007). Select "Paste Special." A Paste Special window appears. In that window, select unformatted text and okay. This will scrub your copied text of all formatting commands and bring in only the text. You can then format the pasted text normally.
Reply With Quote
  #4  
Old 04-13-2011, 02:54 PM
Metamag Metamag is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 64bit
Novice
automatic text formatting(justify)
 
Join Date: Apr 2011
Posts: 23
Metamag is on a distinguished road
Default

That didn't work at all, I tried every kind of paste option.
Reply With Quote
  #5  
Old 04-13-2011, 03:09 PM
BrazzellMarketing BrazzellMarketing is offline automatic text formatting(justify) Windows XP automatic text formatting(justify) Office 2007
Competent Performer
 
Join Date: Apr 2010
Location: Galax, VA
Posts: 120
BrazzellMarketing is on a distinguished road
Default

Is your main problem extra line breaks? Are you copying from HTML pages or PDF pages. Some PDF scripting will insert hard line breaks where the original document had normal text wrapping, and I'm not sure how to get around that.
Reply With Quote
  #6  
Old 04-13-2011, 03:09 PM
macropod's Avatar
macropod macropod is offline automatic text formatting(justify) Windows 7 32bit automatic text formatting(justify) Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,929
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 Metamag,

Often, when you paste text into Word from web sites, email or PDFs, you'll get a paragraph break at the end of each line within a logical paragraph, and two such breaks between logical paragraphs. Such text stubbornly refuses to honour justification, because there's nothing to justify - it's all a series on one-line paragraphs. You should be able to see this if you have Word configured to display formatting marks on-screen. Clicking the symbol on the toolbar/home tab toggles this on/off.

You can fix this kind of paragraph formatting using a series of wildcard Find/Replace actions, with:
Find = [ ^s^t]{1,}^13
Replace = ^p
Find = ([!^13])([^13])([!^13])
Replace = \1 \3
Find = [ ]{2,}
Replace = ^32
Find = ([a-z])-[ ]{1,}([a-z])
Replace = \1\2
Find = [^13]{1,}
Replace = ^p
Note that the above assumes there are at least two such paragraph breaks between the 'real' paragraphs.

A macro equivalent is:
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]

Last edited by macropod; 04-13-2011 at 05:08 PM. Reason: Minor Code Fix
Reply With Quote
  #7  
Old 04-13-2011, 04:08 PM
Metamag Metamag is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 64bit
Novice
automatic text formatting(justify)
 
Join Date: Apr 2011
Posts: 23
Metamag is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
You can fix this kind of paragraph formatting using a series of wildcard Find/Replace actions, with:
Find = ([!^13])([^13])([!^13])
Replace = \1 \3
I used just that part and it fixed everything perfectly! Thank you so much!

Can you tell me what's the rest of the stuff for if just those two lines worked?

I did create that macro you posted but when I ran it I got this-


Probably it would have gotten the job done anyway.
Reply With Quote
  #8  
Old 04-13-2011, 04:13 PM
Metamag Metamag is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 64bit
Novice
automatic text formatting(justify)
 
Join Date: Apr 2011
Posts: 23
Metamag is on a distinguished road
Default

Quote:
Originally Posted by Metamag View Post
P.S.
Also I was wondering if anyone knows of a freeware software that automatically merges multiple html pages into one and/or converts that page into text document?
Oh, I'm still trying to find this so if anyone knows...
Reply With Quote
  #9  
Old 04-13-2011, 04:22 PM
macropod's Avatar
macropod macropod is offline automatic text formatting(justify) Windows 7 32bit automatic text formatting(justify) Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,929
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 Metamag,

Quote:
Originally Posted by Metamag View Post
Can you tell me what's the rest of the stuff for if just those two lines worked?
See the comments in the macro itself.
Quote:
I did create that macro you posted but when I ran it I got this-
That suggests your regional settings for Windows require that you change '{1,}' and '{2,}' in the code to '{1;}' and '{2;}'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #10  
Old 08-05-2011, 10:28 AM
rtcole rtcole is offline automatic text formatting(justify) Windows Vista automatic text formatting(justify) Office 2007
Novice
 
Join Date: Aug 2011
Posts: 3
rtcole is on a distinguished road
Question Word Wrap in another program

I have the same word wrap issues in that each line seems to be a paragraph. It seems very convoluted to use the macro. I have a simple genealogy program that word wraps just fine but it seems silly to copy things to that program to word wrap and then back into Word. Is there no easy way for those of us who do not understand macros?
Reply With Quote
  #11  
Old 08-08-2011, 11:54 PM
macropod's Avatar
macropod macropod is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,929
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

All the macro does is to automate the series of Find/Replace operations described beforehand. No particular understanding of macro is required to use it, any more than you need to understand electronic ignitions and fuel injection to drive a modern car.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 08-10-2011, 02:19 PM
rtcole rtcole is offline automatic text formatting(justify) Windows Vista automatic text formatting(justify) Office 2007
Novice
 
Join Date: Aug 2011
Posts: 3
rtcole is on a distinguished road
Smile Thanks, but how?

I think it would be wonderful to use the macro, but all I can find is how to record a macro. Is there a way to use an edit macro function, or new macro function, then copy the macro above and simply paste it?
Reply With Quote
  #13  
Old 08-11-2011, 02:33 AM
macropod's Avatar
macropod macropod is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,929
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

Links to macro installation & usage instructions are below the code in post #6
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 08-11-2011, 08:22 AM
GJohansson GJohansson is offline automatic text formatting(justify) Windows 7 32bit automatic text formatting(justify) Office 2007
Novice
 
Join Date: Aug 2011
Posts: 17
GJohansson is on a distinguished road
Default Macro to run based on conditions

Quote:
Originally Posted by macropod View Post
Hi Metamag,

Often, when you paste text into Word from web sites, email or PDFs, you'll get a paragraph break at the end of each line within a logical paragraph, and two such breaks between logical paragraphs. Such text stubbornly refuses to honour justification, because there's nothing to justify - it's all a series on one-line paragraphs. You should be able to see this if you have Word configured to display formatting marks on-screen. Clicking the symbol on the toolbar/home tab toggles this on/off.

You can fix this kind of paragraph formatting using a series of wildcard Find/Replace actions, with:
...

A macro equivalent is:
...
i like to justify text to make a long word document looks good. The problem is that this macro when i run it,
changes the all format of the document. Because delete all break lines between text, even the headers of the text. I would like this makro to run, and delete lines, on the text of a document between two styles that im giving to that macro not all the document. Because in that way, combine together even the heading of the document. Is that such way to do that? Im sending you an word document, that you understand what i want to do. I would like to do the same thing the macro does but only between the styles i said to do, to whole document such as between text of heading 1 and heading 2 or heading 2 and heading 3 because if i choose to do this to a whole document gives me problems such as formating of the style of heading 1 to whole document. You can run this macro to the document to see what exact giving.
Attached Files
File Type: docx This is the initial document.docx (13.7 KB, 28 views)
File Type: docx Final document in format i want to do..docx (13.7 KB, 15 views)

Last edited by macropod; 08-13-2011 at 03:47 AM. Reason: i want to insert attachments word files with examples
Reply With Quote
  #15  
Old 08-13-2011, 03:46 AM
macropod's Avatar
macropod macropod is offline automatic text formatting(justify) Windows 7 64bit automatic text formatting(justify) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,929
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 saints,

As indicated in post #6, if you want to clean up just a selected block of text, change:
ActiveDocument
to:
Selection

Trying to code a macro that could deal with every possible heading scenario, etc, is a complicated exercise that is probably not worth the effort.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Formatting for whole row Bacchanal Promotions Excel 2 03-19-2011 05:12 AM
automatic text formatting(justify) Office 2007 Mail Merge Issue - automatic formatting and revisions balloons sharpie21 Office 1 10-10-2010 03:56 AM
Automatic insertion of blank pages or alternate text Diopippo Word 0 07-06-2010 12:13 AM
automatic text formatting(justify) problem with automatic formatting on quotation marks Bobosmite Word 3 05-27-2010 07:06 PM
Templates: automatic text generation from Rich Text content control Chickenmunga Word 0 10-01-2008 11:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:00 PM.


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