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 / Publisher / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Extracting font information from a TextRange

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
YourManInJapan - 18 Apr 2008 14:48 GMT
I need to extract the font information from a Publisher TextRange. For
example, if I have a sentence in mixed italics: "/This is italic/ and this is
not", I need to find out the start and end position of the italicised text.
Is there some functionality equivalent to the "Runs" implemented by the
Office.Core.TextRange2 interface, or do I have to go through character by
character?

I feel like I must be missing something very simple here. Any help would be
greatly appreciated!
Cory - 25 Apr 2008 04:19 GMT
Can you check the state of the Italics button?  I am not on a machine that
had puiblisher on it at the moment, but if you can somehow get a cursor in
the text frame you could move it and check the state of the
italics/underline/bold toolbar buttons.  Otherwise, you could create an
instance of Word, copy/paste the shapes text into the document, and move
about in there leaving the Word application.Visable = False so that it is all
transparent.  Word has cursor and selection movement methods and I am sure
that it can evaluate the use of font modifiers there at least in a
True/False/Mixed capacity.  If not, then I don't know what you could do.

Cory

> I need to extract the font information from a Publisher TextRange. For
> example, if I have a sentence in mixed italics: "/This is italic/ and this is
[quoted text clipped - 5 lines]
> I feel like I must be missing something very simple here. Any help would be
> greatly appreciated!
YourManInJapan - 28 Apr 2008 06:57 GMT
Thanks for your repy, Cory.

You can interrogate the TextRange.Font object to find the font properties of
a TextRange, the problem lies not with accessing the information, but
accessing it in a performant fashion. I can check character 1, then 2, 3 and
so on, but this extreemly slow. I can also check the entire TextRange or any
portion of it, but with little granularity; the TextRange.Font.Italic
property will return true, false or mixed, not the start and end positions of
the italicised text. In this way it somewhat mirrors the state of the Italic
button as suggested in your post.

The key objective here is to find the begining and end of runs of
consistently formatted text in a perfomant way.

> Can you check the state of the Italics button?  I am not on a machine that
> had puiblisher on it at the moment, but if you can somehow get a cursor in
[quoted text clipped - 17 lines]
> > I feel like I must be missing something very simple here. Any help would be
> > greatly appreciated!

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.