-
Autosizing Word Tables to Fit Page
I am using Shapes.AddOLEObject to insert Word tables into PowerPoint slides.
I set the font with ...table.Range.Font.Name='Arial'
I fill the cells with ...table.Cell(i,j).Range.Text='1,234'
In some cases, the number of columns in the table varies, and in most cases the width of the content of the cells varies.
My problem: I want to set the font size to be as large as possible while allowing the entire table to fit on the slide.
I know I can change the font size with something like
table.AutoFitBehavior=wdAutoFitContent
table.Range.Font.Size=14
I figure to start with a large font and then iterate smaller until the table fits. But how can I tell if (say) 14 is small enough to make the table fit on the slide?
An example follows in my next post.
-
Here's an example. I start with 12 points:
[ Please see attached pp.pdf for pictures. ]
But the Asset Class names are wrapped, and the values in the last row are supposed to be "-1.00".
So I reduce to font size to 11 and then to 10:
(picture)
Almost there.
Note that each time I change the font size I seem to have to execute doc.Save and delay for a second in order force PP to update itself with changes to the Word table.
Font size 9.5 does the trick:
(picture)
FYI, so far I have populated just enough cells to get the size right. Here is what the table looks like when I complete the slide:
(picture)
Does anyone have a reliable technique for doing this?
Last edited by wrecks; 10-14-2008 at 05:07 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules