Find if paragraph or sentence contains font (italic,bold,etc)

T

Trevor Lowing

I'm looping through the document at the character level to convert it to
another format. Needless to say, things are slow. Is there any way I can
quickly check if a paragraph or sentence contains font styling or a
special style such as hyperlink(so I can simply return the range.text
for those)?

Thanks,


--
---------------------------------
Trevor Lowing
Satellite Beach, Fl

[email protected]
---------------------------------
Need help with:
Access?
http://www.mvps.org/access/
Outlook?
http://www.slipstick.com/
Visio?
http://www.mvps.org/visio/
HTML/CSS?
http://www.NCDesign.org
Scripting(VBScript/JScript/WSH/XML)?
http://www.DevGuru.com
http://cwashington.netreach.net/
http://developer.irt.org/script/script.htm
---------------------------------
 
H

Helmut Weber

Hi Trevor,

I thought you would like to do that,
but your first posting about the object
model was a bit too theoretical for me.

Unless certain assumptions can be made,
I think, there is no answer. If almost
every second character is in some way
specially formatted, then there is no
use in thinking about objects hierarchy and
checking sections, storyranges, paragraphs
etc first, bevor arriving at the character
level.

If you wanted to locate just one special
formatting, of which you know nothing but
that is in some way special, then I'd check,
somewhat simplified:

Document, Paragraph, Words, characters
or without covering all:
document, sections, storyranges, paragraphs.

The best approach will be somewhere in between,
depending on your documents.

For example, if in a very simple document
MsgBox ActiveDocument.Range.Font.Name
returns "Arial" then all is Arial.
No different font at all.
If MsgBox ActiveDocument.Range.Font.Name
returns "", then there is a font different
from Arial somewhere. But beware of storyranges,
of course.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
Top