Posted by a ceTe Software moderator
Hello,
You are using the correct coordinates for your requirement. However, in your code you are adding TableB to the page itself so the result (TableB added at the top left corner of the page) you are seeing is expected.
In order to add TableB within TableA, you don’t have to dynamically determine the top left of the TableA Row3. You would just add TableB to the cell of Row 3 of TableA. This would add TableB with respect to the top left corner of the cell of TableA Row3. Here is the sample code:
Dim MyDocument As DynamicPDF.Document
Set MyDocument = New DynamicPDF.Document
Dim MyPage
Set MyPage = MyDocument.AddPage()
Dim MyTable As Table2
Set MyTable = MyPage.AddTable2(0, 0, 400, 50)
Dim Column1
Set Column1 = MyTable.AddColumn2(210)
Dim Column2
Set Column2 = MyTable.AddColumn2(100)
Dim Row1
Set Row1 = MyTable.AddRow2()
Row1.AddCell2 "Column #" & 1
Row1.AddCell2 (" Main table Item1")
'Adding Inner table to the cell of the Main table.
Dim MyRow2 As DynamicPDF.Row2
Set MyRow2 = MyTable.AddRow2()
Dim MyCell1 As DynamicPDF.Cell2
Set MyCell1 = MyRow2.AddCell2()
'Build inner table.
Dim MyInnerTable As Table2
Set MyInnerTable = MyCell1.SetTable2(0, 0, 200, 50)
Dim InnerTableColumn1
Set InnerTableColumn1 = MyInnerTable.AddColumn2(100)
Dim InnerTableColumn2
Set InnerTableColumn2 = MyInnerTable.AddColumn2(100)
Dim InnerTableRow1
Set InnerTableRow1 = MyInnerTable.AddRow2()
InnerTableRow1.AddCell2 "Inner table item 1"
InnerTableRow1.AddCell2 ("Inner table item 1")
For i = 2 To 4
Dim InnerTableRow2
Set InnerTableRow2 = MyInnerTable.AddRow2()
InnerTableRow2.AddCell2 "Inner table item " & i
InnerTableRow2.AddCell2 ("Inner table item " & i)
Next
MyInnerTable.Height = MyInnerTable.GetRequiredHeight()
MyRow2.AddCell2 ("Mian table Item2")
MyTable.Height = MyTable.GetRequiredHeight()
Do
Set MyTable = MyPage.AddOverflowTable2(MyTable)
Set MyTable = MyTable.GetOverflowColumns(50, 50, 250, 50)
If MyTable Is Nothing Then
Exit Do
End If
Set MyPage = MyDocument.AddPage()
Loop
MyDocument.DrawToFile ("C:\HelloWorld.pdf")
Thanks,
ceTe Software Support Team.