The function returns the full
width of the table.
The function must be called
within an open page.
Parameters:
Name |
Type |
Description |
tblHandle |
Integer |
The identification number (handle) of a table, obtained from the PdfTableCreate
function. |
Returns:
Type |
Value |
Description |
Double |
>=
0.0 |
If the function succeeds the return value is the width of the table
that was drawn so that additional contents can be drawn beside the table if
necessary. |
-1 |
If the function fails then the return value is -1. |
Available in:
WindowMain |
WindowLink |
YES |
YES |
Hint: You can
find references to XojoScripts which make use of this function by sending the
following SQL statement to the database:
Select id,GUID, ScriptName,ScriptCode from im_scripts
where ScriptCode Like '%PdfTableGetWidth%'
Example XojoScript:
// Create pdf file and add table with 5 rows
If
PdfStart("testfile.pdf")
> 0 Then
// Set top top-left as
0,0 coordinates
PdfSetPageCoordsTopDown
// Define starting
coordinates
Dim x,y As Double = 30.0
Dim hTbl As Integer = PdfTableCreate(1,1,200.0,9.0)
If hTbl >= 0 Then
// Set outer border
Call PdfTableSetBorderWidth(hTbl,-1, -1, 0.5, 0.5, 0.5, 0.5)
// Set inner gridlines
Call PdfTableSetGridWidth(hTbl, 0.5,0.5)
// Add 5 rows of 15.0
points row height
Call PdfTableAddRows(hTbl,5,15.0)
// Draw the table to pdf,
at coordinates x=30 y=30
Call PdfTableDraw(hTbl,x,y,0.0)
// 0.0 = avoid pagebreaks
// Calculate new x
position to the right of table
x = x + PdfTableGetWidth(hTbl)
+ 10.0
End If // hTbl >= 0
// Set output font and
color
PdfSetFont("Arial","Regular",10.0)
Call PdfSetFillColor("&c00000000")
// black textcolor
// write a text
Call PdfWriteText(x,y,"Table
1")
// Finalize PDF
Call PdfCloseFile
// Open PDF in default
viewer
Call Pdflaunch
End
If //
PdfStart("testfile.pdf")