Acessing Paragraph Lines?

J

JBNewsGroup

Hi,

General question with WORD2000.

I converted some text to a 2 column table which has fixed column widths. If
the column 1 text starts with an alphabetic then columns 1 and 2 in that row
are merged. If the text wraps to more than 1 line I would like to be able
to retrieve each line and place a manual line break at the end of the line
(need this for other processing). The text font is a proportional font
(Arial) and is a given and cannot be changed. Is this possible to do?

I looked all over and cannot seem to find anything that would help. I seem
to remember there is a TextWidth function but it seems that it does not
exist in VBA.

Any hints or solutions would be greatly appreciated. If API's are needed
that is acceptable.

Thanks in advance for any help.

Jerry Bodoff
 
J

Jezebel

You can get to the lines of a document through the (somewhat mysterious and
ill-documented) Pages and Rectangles properties of the Pane object ---

activewindow.ActivePane.Pages(1).Rectangles(1).Lines

You'll need to experiment to find out how these objects function, because
no-one seems to have the faintest idea about them (you don't see many posts
about them). From my little experience: the Rectangles collection comprises
the headers, footers, columns, and non-inline shapes on the page. (There
might well be other things that get included.) Each line is a graphic
entity, representing (in effect) a rectangle across the column wholly
enclosing the text of that line.
 
J

JBNewsGroup

Hi Jezebel,

Thanks.

Are we still referring to a table row using this?

Jerry Bodoff
 
J

Jezebel

You can get to *everything* that's represented on the page through that
object; but you'll to do your own research to work out how. :)
 
J

JBNewsGroup

Hi Jezebel,

Thanks for your help. I appreciate it. Now to get it to work.

Jerry Bodoff
 
J

JBNewsGroup

Hi Jezebel,

To find out what I am getting I typed your statement :

activewindow.ActivePane.Pages(1).Rectangles(1).Lines

into a one line macro. When I run the macro in debug I get the error
"method or data member not found" on the Pages(1). Is this something that
is in other than WORD2000?

Doing more searching on the Microsoft KB I found something that gives me the
number of lines in a range of text. That will probably not give me what I
want so "back to the drawing board". I am also looking at API's to see if I
can locate something to give me the actual width of the text. Once I get
that I can figure out where to put the manual line breaks.

Thanks for your help.

Jerry Bodoff
 
J

JBNewsGroup

Hi Jezebel,

I was able to accomplish what I wanted by setting the cursor to the row that
wraps and using the selection object go to the end of the line and put the
manual break. Did that for each line except the last.

Thanks again.

Jerry Bodoff
 
J

Jezebel

Sorry. The feature was added in Word XP.



JBNewsGroup said:
Hi Jezebel,

To find out what I am getting I typed your statement :

activewindow.ActivePane.Pages(1).Rectangles(1).Lines

into a one line macro. When I run the macro in debug I get the error
"method or data member not found" on the Pages(1). Is this something that
is in other than WORD2000?

Doing more searching on the Microsoft KB I found something that gives me
the
number of lines in a range of text. That will probably not give me what I
want so "back to the drawing board". I am also looking at API's to see if
I
can locate something to give me the actual width of the text. Once I get
that I can figure out where to put the manual line breaks.

Thanks for your help.

Jerry Bodoff
 
J

JBNewsGroup

Hi Jezebel,

Not as sorry as I am. It looks like it would be very helpful and useful.

I could never understand why VBA does not allow some additional VB6 type
controls (Grid Control and Toolbar at least, Rich Text control would also be
nice if one knows how to use it). When one has programmed in VB6 it gets to
be a pain trying to replicate those controls in VBA.

Once again you have been very helpful. I really appreciate your time.

Jerry Bodoff
 

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