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 / February 2005

Tip: Looking for answers? Try searching our database.

Problem with .TextFrame.TextRange.Text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Robertson - 07 Feb 2005 23:11 GMT
I'm accessing a Publisher document via COM Automation, and I'm having a
problem with Problem with .TextFrame.TextRange.Text for text frames.

Let's say there is a Publisher document, with a text frame, and the
text frame contains the word "Information".  The text frame can be
resized so that the whole word doesn't show.  For example, you could
resize the text frame so that only "Inform" showed.  Yet, "Information"
is still there, because if you make the text frame larger again, you
see the rest of the word.

However, .TextFrame.TextRange.Text only returns the portion of the word
that is visible in the text frame.  I've been unable to find a way to
retrieve the whole contents of a text frame when the text frame is
smaller than the contents.

I've tried setting TextRange.End and using TextRange.MoveEnd.  Neither
have solved my problem.

Any suggestions would be greatly appreciated!

Signature

Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com

Ed Bennett - 07 Feb 2005 23:26 GMT
> I'm accessing a Publisher document via COM Automation, and I'm having
> a problem with Problem with .TextFrame.TextRange.Text for text frames.

Have you tried .TextFrame.TextRange.Story.TextRange.Text?
Once text enters the overflow area (i.e. no longer appears in the text box),
it is no longer classed as being within the TextRange returned for the
TextFrame, and so it will not appear there.

Signature

Ed Bennett - MVP Microsoft Publisher

Jon Robertson - 08 Feb 2005 14:20 GMT
> .TextFrame.TextRange.Story.TextRange.Text

Thank you, Ed!  That solved it!

I have another question, while I'm at it.  If I set the value of .Text,
then later retrieve it, Publisher puts a CR on the end of the text even
though I didn't put a CR on the end initially.

Also, if I manually examine the text in Publisher, there doesn't appear
to be a CR on the end.

It isn't a major issue.  I now know to look for the CR and to strip it.
It's just annoying.  :)

Thanks again Ed!

Signature

Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com

Ed Bennett - 08 Feb 2005 20:42 GMT
> It isn't a major issue.  I now know to look for the CR and to strip
> it. It's just annoying.  :)

If you go to the end of a text box in Publisher (press Ctrl-End), and press
Shift-Right, the paragraph mark at the end of the last paragraph becomes
selected.
There is always a paragraph mark at the end of a text box.

You can just use Left$(TextRange.Text, Len(TextRange.Text) - 1)

(Note that if you are iterating through text boxes looking for empty ones,
Len(TextRange.Text) will be 1, not 0, as empty text boxes always contain a
paragraph mark.

Signature

Ed Bennett - MVP Microsoft Publisher

 
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.