Working with tables example


#1

Hello

thanks for the introduction of tables and adding rows.

Please could i have an example of how i would change text in a table and then
what happens when you add a new row.

Does the new row have the same text as the last row or is it empty?

Thanks


#2

Dear James,

Table.GetCell(column, row) function returns TextFrame object. You can use it in the same way as before.
New row has the same text as last row in the table.

Now it has limitations:

  • It’s not possible to add text to the empty cells.
  • You don’t have access to frames. (It’s possible to change style of lines through GroupShape). Later I will add possibility to change frames for any TextFrames (and for Tables too).

#3

Hi

I have manged to change the text in the table cells and also add rows, but when i do the fomatting of the table is lost.

Instead the table appears near the bottom all scrunched up.

It looks like Row height is lost and table top position is lost.

Thanks


#4
Dear James,

Yes, it's my bug. I'm moving table down instead of changing size.
It was fixed and new hot fix will be published today.

Small example for your Aeon.ppt presentation.

' Find first slide
Dim slide As Slide = Nothing
Dim i As Integer
For i = 0 To pres.Slides.Count - 1 Step i + 1
If pres.Slides(i).SlidePosition = 1 Then
slide = pres.Slides(i)
Exit For
End If
Next

If Not slide Is Nothing Then
' Find table
Dim table As table = Nothing
Dim i As Integer
For i = 0 To slide.Shapes.Count - 1 Step i + 1
If TypeOf slide.Shapes(i) Is table Then
table = CType(slide.Shapes(i), table)
Exit For
End If
Next

If Not table Is Nothing Then
' Add 2 new rows to the table
table.AddRow()
table.AddRow()

' Replace text in the cells
Dim ii As Integer
For ii = 0 To table.ColumnsNumber - 1 Step ii + 1
' Skip first row because it's a header
Dim jj As Integer
For jj = 1 To table.RowsNumber - 1 Step jj + 1
Dim tf As TextFrame = table.GetCell(ii, jj)
If Not tf Is Nothing And tf.Text.Length > 0 Then
tf.Paragraphs(0).Portions(0).Text = "(" + ii.ToString() + ", " + jj.ToString() + ")"
End If
Next
Next
End If
End If