When adding rows to a table...

This is a read only forum. It contains the most frequently asked questions about Amyuni products and licensing.
Post Reply
Dany
Amyuni Team
Posts: 113
Joined: Wed Sep 11 2002
Location: Montreal.
Contact:

When adding rows to a table...

Post by Dany »

all the data in the table is lost, why?

You must be re-initializing the table while adding rows to it.
If you wish to add a row and keep the existing table data you may use the code snippet below:

Private Sub cmdAddRow_Click()
Dim intRows As Integer
Dim intRowWidth As Integer

With PDF1
'Open PDF document which includes the table object that you
'want to add rows to.
.Open App.Path & "\sample.pdf", ""

'Put the Documetn into design mode
.DoCommandTool (acCommandToolDesignMode)

'Active the object
.ActivateObject "Table 1"

'Find number of rows in the opened document
intRows = .ObjectAttribute("Table 1", "Rows")

'Get width of Table object
intRowWidth = (.ObjectAttribute("Table 1", "Bottom")) - _
(.ObjectAttribute("Table 1", "Top"))

'Insert new row into Table
.DoCommandTool (acCommandToolInsertRow)

'Inlarge Table in order to add ne row
' Table Bottom = Table width / number of rows
.ObjectAttribute("Table 1", "Bottom") = CInt(intRowWidth / intRows) + _
CInt(.ObjectAttribute("Table 1", "Bottom"))

'Compile new document
.DoCommandTool (acCommandToolRunDocument)

.Refresh
.Save App.Path & "\sample_revised.pdf", 0
End With
End Sub
Post Reply