Discussion:
How can I tell if lines will wrap in Word
(too old to reply)
Ethan Strauss
2009-07-14 18:37:01 UTC
Permalink
Hi,
I am using C#.net with VSTO to make an addin for Word. I have some
specific text I woudl like to format in specific ways. I would like to know
if the ends of lines are actually wrapping to the next line. If they are, I
will reduce the font size. Is there a way I can tell if the lines are
actually wrapping?
Thanks,
Ethan
Cindy M.
2009-07-15 18:31:12 UTC
Permalink
Hi Ethan,
Post by Ethan Strauss
I am using C#.net with VSTO to make an addin for Word. I have some
specific text I woudl like to format in specific ways. I would like to know
if the ends of lines are actually wrapping to the next line. If they are, I
will reduce the font size. Is there a way I can tell if the lines are
actually wrapping?
Mmm. Basically, the answer to your question is, No. You can't really know this
ahead of time. You can only determine it once it's already happened - and
there is no event that will tell you it's happened.

If you've written the text to the document (using Range.Text, preferably), you
can get the number of lines like this:

Range.ComputeStatistics(wdStatisticLines)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Loading...