Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Creates a new table object.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
AllocRows | The number of rows to preallocate. | 10 |
NumCols | The number of columns. | 5 |
Width | The width of table. | 500 |
DefRowHeight | The default row height for a new row. | 30 |
Returns table identifier or error.
Create table with 10 preallocated rows, 2 columns, 500 point width and 10 point default row height:
MBS("DynaPDF.Table.Create"; $pdf; 10; 2; 500; 10)
Create table and set some properties:
Set Variable [$table; Value:MBS("DynaPDF.Table.Create"; $pdf; 10; 2; 500; 10)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetBorderWidth"; $table; -1; -1; 1; 1; 1; 1)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetRGBColor"; $table; -1; -1; "BorderColor"; 255; 255; 255)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetRGBColor"; $table; -1; -1; "GridHorzColor"; 255; 255; 255)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetRGBColor"; $table; -1; -1; "GridVertColor"; 255; 255; 255)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetRGBColor"; $table; -1; -1; "TextColor"; 0; 0; 0)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetGridWidth"; $table; 10; 10)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetColWidth"; $table; 0; 200;1)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetColWidth"; $table; 1; 300;1)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetFont"; $table; -1; -1; "Helvetica"; 0; 1; "unicode")]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetFontSize"; $table; -1; -1; 10)]
Complete example using a simple table on one page:
# Initialize DynaPDF if needed
If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
Perform Script [ “InitDynaPDF” ]
End If
# Clear current PDF document
Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
# coordinates top down instead the default Bottom Up
Set Variable [ $r; Value:MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") ]
# Create Table
Set Variable [ $table; Value:MBS("DynaPDF.Table.Create"; $pdf; 3; 3; 500; 100) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetBorderWidth"; $table; -1; -1; 1; 1; 1; 1) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetGridWidth"; $table; 1; 1) ]
# Add Rows
Set Variable [ $text; Value:"The cell alignment can be set for text, images, and templates..." ]
Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.AddRow"; $table) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; $text) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "center"; "top"; $text) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 2; "right"; "top"; $text) ]
Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.AddRow"; $table) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "center"; $text) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "center"; "center"; $text) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 2; "right"; "center"; $text) ]
Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.AddRow"; $table) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "bottom"; $text) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "center"; "bottom"; $text) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 2; "right"; "bottom"; $text) ]
# Draw Table (just one page without loop)
Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.Draw"; $table; 50; 50; 742) ]
Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
# Cleanup
Set Field [ Tables::OutputPDF; MBS("DynaPDF.Save"; $pdf) ]
Set Variable [ $r; Value:MBS("DynaPDF.Table.Release"; $table) ]
Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
Created 18th August 2014, last changed 17th January 2019
DynaPDF.Table.ClearRow - DynaPDF.Table.DeleteCol
Feedback: Report problem or ask question.