Trouble setting table fonts via automation

T

Tim Witort

PowerPoint 2003 SP3
VFP 6 SP5

I am using automation via Visual FoxPro to build some
PowerPoint presentations. I have a basic slide already
prepared featuring a couple of textboxes and a table.
My automation code adds several rows to the table using:

loTbl.Rows.Add()

And fills the contents of the rows like so:

loRow = loTbl.Rows[loTbl.Rows.Count]
loRow.Cells[1].Shape.TextFrame.TextRange.Text = "some text"

After I have added the rows and populated them with the
desired text, I format the text like so:

lnRows = loTbl.Rows.Count
FOR lnCurRow = lnRows TO 1 STEP -1

FOR lnCurCol = 1 TO 7
WITH loTbl.Cell
(lnCurRow,lnCurCol).Shape.TextFrame.TextRange.Font
.Name = "Arial Narrow"
.Size = 12
.Bold = .F.
ENDWITH

ENDFOR
ENDFOR

Everything about this works fine except the Bold property.
When I examine the resulting presentation in PowerPoint, it
seems that the Bold property on some of the text in the table
has been applied and some has not. When I check the property
as I am setting it like so:

messagebox("Bold: "+TRANSFORM(.Bold))

It always correctly reports that the property is 0 (false).
Yet when the presentation is opened in PowerPoint, the first
row in the table is Bold rather than non-Bold.

Is there an additional method call I need to make so that
the font properties will "stick"? Could there be some aspect
of my starting slide file that is causing the font settings
problem?

-- TRW
_______________________________________
t i m . w i t o r t
_______________________________________
 
B

Brian Reilly, MVP

Tim,
I don't have a clue about FoxPro syntax, it is very different from VBA
but I'd guess if the first row is the only bad row, then it is in the
counting back in the line
FOR lnCurRow = lnRows TO 1 STEP -1
I'd test this with changing it TO STEP-1 and see if that helps or
change lnRows to lnRows +1

Brian Reilly, MVP
 
T

Tim Witort

Brian Reilly, MVP seemed to utter in
Tim,
I don't have a clue about FoxPro syntax, it is very different from VBA
but I'd guess if the first row is the only bad row, then it is in the
counting back in the line
FOR lnCurRow = lnRows TO 1 STEP -1
I'd test this with changing it TO STEP-1 and see if that helps or
change lnRows to lnRows +1

Brian Reilly, MVP

Thanks for the input, Brian. The looping logic is
definitely hitting all of the rows. I've confirmed
this in the debugger numerous times since I can reliably
change all of the other properties of the font in all
rows except the Bold property which is irrational. The
bold property behaves as expected in textbox objects via
automation and can be changed within PowerPoint itself
in both textboxes and tables. Via automation within
tables, it behaves strangely and unpredictably.

Until I figure out a reliable fix, my users will just
have to fix these things manually after the presentations
are built.

-- TRW
_______________________________________
t i m . w i t o r t
_______________________________________
 
B

Brian Reilly, MVP

tim,
sorry it doesn't work. Yet another reason I always use XL ranges as
tables instead of PPT wimp Tables.

Good luck,

Brian Reilly, MVP
 
T

Tim Witort

Brian Reilly, MVP seemed to utter in @4ax.com:
tim,
sorry it doesn't work. Yet another reason I always use XL ranges as
tables instead of PPT wimp Tables.

Good luck,

Brian Reilly, MVP

There's an idea - dropping an Excel table in there instead.
Might have to try that one. I've already replaced one
troublesome table with separate texboxes, but some slides
really require a table.

-- TRW
_______________________________________
t i m . w i t o r t
_______________________________________
 

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