Add Text after table

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for COM/ActiveX (v7)  /  Add Text after table

DynamicPDF CoreSuite for COM/ActiveX (v7) Forum

 Jan 11 2014 12:32 PM
Hi,

i'm trying your product and i'm happy with it.
I want to buy the version but first i need to see my complete project with the evaluation version.

I still missing some thinks, but now:
- i don't know how to use addtextArea when i don't know dimension, as i already put a table with many rows with overflow , that go multipage.

So i want to add some text at the end of all the main table.

So i don't know the position 130 and 150 !!!
myPage.AddTextArea "MY TEXT", 130, 150, 200, 200, DPDF_Align_Left, DPDF_Font_Helvetica, 12


Thanks for your support.
 Jan 13 2014 10:53 AM
Posted by a ceTe Software moderator
Hello,

Yes, you can add text below the overflow table contents without any problem using our DynamicPDF Generator product. You will need to build the complete table using Table2 class and add it to the PDF by checking for overflow rows accordingly, then keep track of Y position and height of the overflow table using two local variables. Use the calculated Y position to  add the TextArea after the table. Here is the sample VB code: 

    Dim tableYPoistion As Single
    tableYPoistion = 0
    Dim tableHeight As Single
    tableHeight = 0
    Dim MyDocument As DynamicPDF.Document
    Dim MyPage As DynamicPDF.Page
    Set MyDocument = New DynamicPDF.Document
    Set MyPage = MyDocument.AddPage()
    Dim MyTable As DynamicPDF.Table2
    Set MyTable = MyPage.AddTable2(0, 0, 200, 700)
    MyTable.AddColumn2 (100)
    MyTable.AddColumn2 (100)
    ' This loop populates the table
    Dim I As Integer
    For I = 1 To 400
            Dim MyRow As DynamicPDF.Row2
            Set MyRow = MyTable.AddRow2()
            MyRow.AddCell2 ("Row #" & I)
            MyRow.AddCell2 ("Item")
    Next
    
    Do
       Dim MyOverflowTable As DynamicPDF.Table2
       Set MyOverflowTable = MyTable.GetOverFlowRows()
       If Not (MyOverflowTable Is Nothing) Then
           Set MyPage = MyDocument.AddPage()
           Set MyTable = MyPage.AddOverflowTable2(MyOverflowTable)
           'get the Y position of the Table2
           tableYPoistion = MyTable.Y
           'Get the visible height od overflow table.
           tableHeight = MyTable.GetVisibleHeight()
       End If
    Loop While Not (MyOverflowTable Is Nothing)
    
    Dim MyTextArea As DynamicPDF.TextArea
    Dim padding As Single
    padding = 10
    'Calculate Y position for TextArea.
    Dim YPosition As Single
    YPosition = tableYPoistion + tableHeight + padding
    'Add the TextArea with calulated Y position and Height to the Page.
    Set MyTextArea = MyPage.AddTextArea("My TEXT", 100, YPosition, 200, 30, DPDF_Align_Left, DPDF_Font_Helvetica, 12)
    MyDocument.DrawToFile ("C:\Temp\Mydocuent_COM.pdf")

Thanks,
ceTe Software Support Team.
 Jan 13 2014 7:08 PM
hi,

thanks for your example but currently i have a problem.

The page is height 600.

a table is using 900, so 1 page and half.
At position Y i get 300, so the position on page2. OK


But if after i add another table height 600.

So i call
Set myTable = MyPage.AddTable2(0, PosY, 560, 600, DPDF_Font_Helvetica, 12)

Now the problem is that this table have to be split into 2 pages but actually isn't !!! So i get a big problem !

Can you help me please ?
Which mistake i making in the 2°table ?

Thanks,
Marco
 Jan 13 2014 7:57 PM
I try to explain again my problem as maybe i wasn't clear.


I have a pdf with 2 tables.
And for both tables i don't know height... ( of course i want to use all my space available.

So if the page is height 475.

For first table i use
Set myTable = MyPage.AddTable2(0, 270, 560, 475, DPDF_Font_Helvetica, 12)

........add many rows.....


and then i need to add another table where i don't have an idea of how much text there can be inside... so height may change...
and probably this second table is going to 1 or 2 or 3 pages.... depending on text.

Thanks for calculating posY of the first table.
But how can i add second table starting immidiatly after 1°table ??
Set myTable = MyPage.AddTable2(0, POSY, 560, 475, DPDF_Font_Helvetica, 12) <--- this is the solution BUT if this table is going on 2 pages it start at a wrong position
 Jan 14 2014 3:28 PM
hi support.

Thanks, i solve it by adding this code:




                myTable.Y = 270
                myTable.height = 475
                

this 2 instructions i use them on only the 2°table, after the "painting" of page1.
So after the first time call
Call AddTableToPage(MyDocument, MyPage, myTable, currentRow, currentColumn)


The Y = 270 is equal to 0 for me as i'm using a Header. So Y=0 is my first position free.
And height=475 is my total area available excluded header.

                

So for painting the second table i use:
AreaLibera = MyPage.PageHeight - posY - 50
'Set myTable = MyPage.AddTable2(0, posY, 560, AreaLibera, DPDF_Font_Helvetica, 12)


and after painting the first page i called
myTable.Y = 270
myTable.height = 475

to reset all for the new pages.


thanks for your examples and support as they was necessary to help me to find this solution.

Thanks,
Marco
                
 Jan 14 2014 3:38 PM
Posted by a ceTe Software moderator
Hello,

Yes, your approach is correct. When the second table overflows to the next page you have get the overflow of the table and reset the Y position to zero or to a desired Y coordinate.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 4:26 PM.