Matt LeGro
Matt LeGro

Reputation: 1

How to fill tables in powerpoint from a cell array in matlab?

I've downloaded saveppt2, jrichter's code and even WritetoWordfromMatlab and tried reading through them to figure it out with no luck. I have something of my own built already so I just need to figure out how to get tables to work.

Whenever I try something like:

myTable.Cell(1,1).TextFrame.Text = 'textstring'

or

myTable.Table.Cell(1,1) = 'textstring'

Or any combination of table / text commands I end up with there being no such property or function as cell for table objects. Every COM/VBA/C library I can find, as well as some code in Python (PandastoPowerPoint from Github) that does what I'm aiming to do says that Table.Cell(row,col) should work. Is this specifically a problem with matlab trying to use (#,#) as a form of indexing?

Upvotes: 0

Views: 314

Answers (2)

Matt LeGro
Matt LeGro

Reputation: 1

Thanks Steve R! With a little tweak, I got it to work, finally. So here's the answer:

% add table to existing slide object

myTable = slide.Shapes.addTable(nRows,nCols,x0,y0,rowWidthnRows,colHeightnCols) myTable.Table.Cell(1, 1).Shape.TextFrame.TextRange.Text = 'TextString'

Upvotes: 0

Steve Rindsberg
Steve Rindsberg

Reputation: 14809

Try

 myTable.Cell(1, 1).Shape.TextFrame.TextRange.Text = "TextString"

or = 'TextString' if that's what matlab prefers.

Upvotes: 1

Related Questions