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.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
Statistic
FMM
Blog
DynaPDF.Table.Create
Creates a new table object.
Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
DynaPDF | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
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 |
Result
Returns table identifier or error.
Description
Creates a new table object.The parameter AllocRows specifies 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).
The default row height is used if the parameter Height of AddRow() or AddRows() is set to a negative value.
The widths of the columns is set to the table width divided by the number of columns (Width / NumCols).
The table must be deleted with DynaPDF.Table.Release when finish to avoid a memory leak.
DynaPDF table reference numbers are starting at 21000 and counting up for each new table.
Examples
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) ]
See also
- DynaPDF.Release
- DynaPDF.Save
- DynaPDF.SetPageCoords
- DynaPDF.Table.AddRow
- DynaPDF.Table.AddRows
- DynaPDF.Table.Draw
- DynaPDF.Table.Release
- DynaPDF.Table.SetColWidth
- DynaPDF.Table.SetFontSize
- DynaPDF.Table.SetRGBColor
Example Databases
- DynaPDF/Catalog with tables
- DynaPDF/Invoice/Invoice
- DynaPDF/Merge PDFs
- DynaPDF/Report
- DynaPDF/Tables
Blog Entries
- Merge PDF with table of contents
- DynaPDF Screenshot
- MBS FileMaker Plugin, version 8.4pr2
- MBS FileMaker Plugin 3.5 for OS X/Windows - More than 2100 Functions In One Plugin
Release notes
- Version 8.4
- Changed DynaPDF.Table.Create to automatically load font Helvetica, so you have a font defined, if you don't set one yourself.
Created 18th August 2014, last changed 17th January 2019
DynaPDF.Table.ClearRow - DynaPDF.Table.DeleteCol
Feedback: Report problem or ask question.

Links
MBS Xojo Chart Plugins