To stat, thank you for your time Tony,
As to why the tables, it is because there are many templates in place and
they have the text tables already, each with potentially varied fonts and
formats, so they are not avoidable.
For the vertical position - yes - my bad, I do mean horizontal. This is
what I intended to do:
I noticed that if I selected the line of text just below my text table and
right justifying that line, it would automatically be positioned just to the
left of my image table. Since the desired width of my next text row is also
just to the left of my image table, I thought I could get the
'wdHorizontalPositionRelativeToPage' and use it to set the width of my next
row. However the number I get back is always the same (my right margin)
whether I have an image table or not on the right.
Initially I though I would make a 'map' from the bottoms and widths of the
image tables and contour my text rows to that map, but finding the bottoms
of the tables has also eluded me.
I will attempt to show the layout, I hope the spacing translates!
| | |
|
| | | IMAGE TABLE ONE |
| | | (WIDE)
|
| | ---------------------------------------------- |
| | --> --> |
|
| TEXT TABLE | WANT TO --> | IMAGE TABLE |
| | WIDEN ROW --> | TWO |
| | TO USE THIS SPACE | |
----------------------- |
|
(NEXT LINE) (RIGHT JUSTIFIED CUSOR) ^ | |
Thanks again
> Hi scottw,
>
[quoted text clipped - 35 lines]
> my
> > bookmark is right justified so it must be on the margin.)
Jezebel - 27 Mar 2006 23:08 GMT
For a different approach to this, have a look at the
ActiveWindow.ActivePane.Pages(n).Rectangles collection. You'll be something
of a pioneer if you can work with this, because the documentation is cursory
to say the least and I've seen almost no references to it in postings here
(and it's a recent addition to Word VBA). But it's a part of the Word object
model that appears to be intended for your sort of purpose - ie, working
with the things on the page specifically as graphic elements.
> To stat, thank you for your time Tony,
>
[quoted text clipped - 88 lines]
>> my
>> > bookmark is right justified so it must be on the margin.)
scottw - 28 Mar 2006 15:22 GMT
Hi Jezebel and thanks for the input. I took a look at the pane object model,
but could not find a way to get it to report what I needed. If you happen
to come accross a way for it (or any other object) to return the exact
position (as opposed to the position of the right page margin) of a right
justified cusor, that would solve my problem. Do you know if the panes
collection has a 'rectangle ' (or anything) that contains the paragraphs
between the images?
Thanks again,
Scott
> For a different approach to this, have a look at the
> ActiveWindow.ActivePane.Pages(n).Rectangles collection. You'll be something
[quoted text clipped - 96 lines]
> >> my
> >> > bookmark is right justified so it must be on the margin.)
Jezebel - 28 Mar 2006 22:49 GMT
The rectangles collection includes *everything* on the page.
> Hi Jezebel and thanks for the input. I took a look at the pane object
> model,
[quoted text clipped - 125 lines]
>> >> my
>> >> > bookmark is right justified so it must be on the margin.)
Tony Jollans - 27 Mar 2006 23:37 GMT
You are attempting something rather difficult but, more importantly, you are
trying to outdo Word. I suspect that you will come to grief sooner or later
with this and really would encourage you to find an alternative method.
If you have to use the text tables, what about the images? Couldn't they be
placed inside the text table so that text could flow round them within the
table cells - or do the images really need to line up with each other rather
than any related text?
--
Enjoy,
Tony
> To stat, thank you for your time Tony,
>
[quoted text clipped - 24 lines]
> | | | (WIDE)
> |
| ---------------------------------------------- |
> | | --> --> |
> |
[quoted text clipped - 47 lines]
> > my
> > > bookmark is right justified so it must be on the margin.)
scottw - 28 Mar 2006 15:13 GMT
Thank you Tony (and Jezebel) for the help.
The problem that limits me is not knowing the size in advance for any of
these tables, so putting an image in one of them would only solve the problem
if the image was just right for that table.
I'm convinced that you are right about the difficulty of this, still
looking for the alternative method though. The users of these reports are
very picky about style things like font type, size and color and the styles
vary greatly, even from table to table (and cell to cell) within one report.
Having the tables also gives non tech users an interface for laying out
those styles, etc.
The only way I could imagine to replace these tables would be having VB read
each table's style properties then remove the table and type the contents
back. But, since hundreds of these templates already exist, and contents
come from a mix of code and the tables themselves - this code would need to
be able to read the code modules of these templates at the same time!
It seems so much more reasonable to have a function that would simply add
rows whos widths were based on the left edge of the pre-placed image tables
to the right. I could then simply replace any code that puts text into a
cell with a call to this function, and the function would minimize the
area between the text row ends and the images.
If only that right justified cursor could tell me its real vertical
position! That way I could know exactly what the right edge of my text area.
Instead it tells me the right margin of the page.
Thanks for the efforts,
Scott
> You are attempting something rather difficult but, more importantly, you are
> trying to outdo Word. I suspect that you will come to grief sooner or later
[quoted text clipped - 101 lines]
> > > my
> > > > bookmark is right justified so it must be on the margin.)
Tony Jollans - 29 Mar 2006 19:55 GMT
Caveat: This is based on trial and error to a certain extent.
I'm not sure enough of your layout to take this further but see if this is
any help. It will pop a message box with the coordinates of the bottom left
corner of a table (in points from the top left of the page).
Set T = ActiveDocument.Tables(2) ' Your table here
Set C = T.Range.Cells(T.Range.Cells.Count).Range
P = C.Information(wdActiveEndPageNumber)
For Each R In ActiveWindow.ActivePane.Pages(P).Rectangles
If R.RectangleType = wdTextRectangle Then
If R.Range.Start <= C.Start And R.Range.End >= C.End Then
Exit For
End If
End If
Next
MsgBox "Bottom of Table is at " & vbTab & R.Top + R.Height & vbCr & _
" Left of Table is at " & vbTab & R.Left
--
Enjoy,
Tony
> Thank you Tony (and Jezebel) for the help.
>
[quoted text clipped - 74 lines]
> > > | | | (WIDE)
> > > |
| ---------------------------------------------- |
> > > | | --> --> |
> > > |
[quoted text clipped - 55 lines]
> > > > my
> > > > > bookmark is right justified so it must be on the margin.)
scottw - 30 Mar 2006 06:07 GMT
Sterling work Tony, as was (I am painfully learning) your earlier
assessment that mentions 'rather difficult' and 'grief'!
Thank you very much.
Scott W.
> Caveat: This is based on trial and error to a certain extent.
>
[quoted text clipped - 192 lines]
> > > > > my
> > > > > > bookmark is right justified so it must be on the margin.)