font changes for the same TextRange

A

Aurora I

In case when the text (TextRange) uses more than one font ( type, color, size, facebold, etc ...) , how do I detect the font changes other than checking character by character ?

exemple :
1 Test for text. 2Test for text. 3 Test for text.

Thanks,
Aurora
 
S

Steve Rindsberg

In case when the text (TextRange) uses more than one font ( type, color,
size, facebold, etc ...) , how do I detect the font changes other than
checking character by character ?

exemple :


1 Test for text.
2Test for text. 3 Test for text.


It's hard to say since you don't mention what application you're working with.
 
A

Aurora I

Steve Rindsberg said:
It's hard to say since you don't mention what application you're working
with.


The application is a converter from PowerPoint format to XML format. I know
that I can get the Font collection for an active presentation. I need to
detect in a text from a TextRange any font change ( as family name, size,
etc) i.e where each Font is used.

Thank you,
Aurora
 
S

Steve Rindsberg

The application is a converter from PowerPoint format to XML format. I know
that I can get the Font collection for an active presentation. I need to
detect in a text from a TextRange any font change ( as family name, size,
etc) i.e where each Font is used.

Use the .Runs collection of the TextRange

Sub RunWithIt()

Dim oSh As Shape
Dim x As Long
' get a reference to the selected shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)

With oSh.TextFrame.TextRange
For x = 1 To .Runs.Count
With .Runs(x)
Debug.Print .Font.Name
Debug.Print .Font.Color.RGB
Debug.Print .Font.Bold
End With
Next
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top