Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2005

Tip: Looking for answers? Try searching our database.

Non-style-based formatting within a paragraph

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Edward Thrashcort - 22 Aug 2005 21:41 GMT
Word 2000/XP

Is there any way to select text within a paragraph that has ANY formatting
that's NOT part of the style for that paragraph?

Eddie Thrashcort
Edward Thrashcort - 23 Aug 2005 12:51 GMT
I'll take that as a "no" then?

Eddie

> Word 2000/XP
>
> Is there any way to select text within a paragraph that has ANY
> formatting that's NOT part of the style for that paragraph?
>
> Eddie Thrashcort
Klaus Linke - 23 Aug 2005 14:35 GMT
Hi Edward,

Right, no. At least no simple, built-in command that does anything like
that.

In Word2003, you have an option to "keep track of formatting". Manual
formatting is then treated much the same way as styles.
You can then select all occurrences of some type of manual formatting (say
"Arial" or "bold") at once (Word2003 allows multiple noncontiguous
selections) and do something with them. VBA support for multiple selections
doesn't exist though, unfortunately.

Word2003 also has XML support. If you need to detect manual formatting to
"tag" it for some custom export format, it may be simpler to start with that
XML and twiddle that (say, write a custom XSLT).

If you describe what you want to do after you have selected the manually
formatted text, maybe someone will have an idea how to do that in Word2000.

Regards,
Klaus

> I'll take that as a "no" then?
>
[quoted text clipped - 6 lines]
>>
>> Eddie Thrashcort
Edward Thrashcort - 23 Aug 2005 15:18 GMT
The job is for a client who has Word 2000 and Word XP.
They want it to work on both versions.

They want to extract contact data from hundreds of word documents and all
such data has in common that it has been highlighted in some way - eg change
of font, bold, italics, change of colour etc.  Anything that's not Normal
font has been tweaked by hand because the original data was "spat-out" by a
computer at some time in the last 5 years and would therefore have been
Normal style (or plain-text or body-text etc).

I haven't tried this yet but maybe I could store all the characteristics of
the paragraph style and then us Find to search for things like

eg something on the lines of ....

   With Selection.Find.Font
       .Color = Not(wdColorRed)
   End With

   With Selection.Find.Font
       .Color <> wdColorRed
   End With

I'm not sure if you can search for the absence of something.
Also there would probably be a LOT of properties to search for.

If after finding and extracting some text, I then reverted it to the default
paragraph font, then this would prevent it from being selected more than
once because it was bold AND italic AND green

Eddie
Klaus Linke - 23 Aug 2005 22:41 GMT
Hi Eddie,

>    With Selection.Find.Font
>        .Color = Not(wdColorRed)
[quoted text clipped - 3 lines]
>        .Color <> wdColorRed
>    End With

That won't work, I'm afraid. In your case, I'd probably try to figure out
all the "highlighting" that has been used (bold, italic, highlighted,
color=red, ...) and search for that. Assuming that bold, italic,
highlighted, color=red .... haven't been used in the styles, that is.

To find (or tag) arbitrary manual formatting will be more difficult.

The way I do it is to make a copy of the document where all paragraph styles
look like Normal style:
       myStyle.Font = ActiveDocument.Styles(wdStyleNormal).Font
       myStyle.ParagraphFormat =
ActiveDocument.Styles(wdStyleNormal).ParagraphFormat

For character styles:
       myStyle.Font = ActiveDocument.Styles(wdStyleNormal).Font

A document that originally was formatted wholly with character styles and
paragraph styles will now look like plain unformatted text with those style
definitions.

Any remaining formatting that is still applied (italic, bold, space before,
...) has been applied manually.

You'll still need to search for all kinds of formatting separately, but at
least you won't match bold headings when searching for bold, and so on.

Greetings,
Klaus

> The job is for a client who has Word 2000 and Word XP.
> They want it to work on both versions.
[quoted text clipped - 31 lines]
>
> Eddie

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.