Create a new pdf table
object.
Parameters:
Name |
Type |
Description |
rows |
Integer |
The number of rows which should be pre-allocated. The value
should be large enough to avoid unnecessary memory reallocations. Note that
this is just the size of the array that holds the rows which will be added
later. Unused rows require 4 or 8 bytes memory (32 bit / 64 bit). |
cols |
Integer |
The number of rows which should be pre-allocated. |
width |
Double |
The width of the table in points, for example: 200.0 The widths of the columns is set to the table width divided by the
number of columns (Width / NumCols). To set width of columns, see: PdfTableSetColumnWidth |
rowheight |
Double |
Default row height in points. The specified rowheight
represents the minumum height of each row. If the height of a foreground
object is larger, then the row height will be adjusted. Example row height: 9.0 The default row height is used if the parameter height of PdfTableAddRow
or PdfTableAddRows
is set to a negative value. |
Returns:
Type |
Value |
Description |
Integer |
>=
0 |
The identification number (handle) of a table |
Integer |
-1 |
failed to create a new table object |
Integer |
-2 |
An unknown exception occured |
Available in:
WindowMain |
WindowLink |
YES |
YES |
Used in:
XojoScript
Name |
GUID |
Create
Seminar Invoice With Slip As PDF |
739DA58E-17EE-41CE-BB54-E7362CFE17D4 |
Create
Seminar Invoice As PDF |
2C3F7F29-A29A-4338-ACF5-51894B709DA5 |
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 '%PdfTableCreate%'
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
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,30.0,30.0,0.0) // 0.0 = avoid pagebreaks
End If // hTbl >= 0
// Finalize PDF
Call PdfCloseFile
// Open PDF in default
viewer
Call Pdflaunch
End
If //
PdfStart("testfile.pdf")