Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.Table.SetCellTemplate
Inserts a template into the specified cell.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "DynaPDF.Table.SetCellTemplate"; Table; Row; Col; ForeGround; HAlign; VAlign; TmplHandle { ; Width; Height } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Table | The identifier for the table. | $Table | |
Row | The row number. Range from 0 to DynaPDF.Table.GetNumRows-1. Or -1 for whole table. | 0 | |
Col | The column number. Range from 0 to DynaPDF.Table.GetNumCols-1. Or -1 for whole table. | 0 | |
ForeGround | 1 = forground, 0 = background. | 1 | |
HAlign | The horizontal alignment. Can be left, center or right. | "center" | |
VAlign | The vertical alignment. Can be bottom, center or top. | "center" | |
TmplHandle | The template handle as returned by DynaPDF.ImportPageAsTemplate function. | $template | |
Width | The desired width. | 0 | Optional |
Height | The desired height | 0 | Optional |
Result
Returns OK or error.
Description
Inserts a template into the specified cell.A template can contain contents from external sources like PDF or EMF pages as well as anything that can be drawn on a page (with exception of interactive objects like form fields or annotations).
Please note that the table creates no copy of the template. Template handles are bound on the PDF instance in which they were created and all templates will be deleted when the PDF file in memory is closed or when DynaPDF.Release will be called.
Therefore, it is not possible to draw a table with templates into different PDF files.
If the template is inserted as a background object, then it will be clipped if it does not fit into the cell boundary. A cell can contain a background and a foreground object.
A template can also be added to the table as background object.
Foreground objects have a strong width and height. That means the cell will be expanded if necessary.
Templates can be scaled into the cell as follows:
- Width = 0 and Height = 0 -> The template is scaled to the cell width or height depending on the cell orientation. The aspect ratio will be preserved. If the flag tfScaleToRect is set, the template is scaled so that both sides fit into the cell width and height. The row height must be greater zero to achieve a meaningful result.
- Width > 0 and Height = 0 or Width = 0 and Height > 0 -> The template is scaled to the given width or height. The aspect ratio will be preserved. If the flag tfScaleToRect is set, the template is scaled so that both sides fit into the given width or height and into cell width or height depending on which side is missing. If the parameter Height and the row height are zero then the flag tfScaleToRect has no effect.
- Width > 0 and Height > 0 -> The template is scaled to the given width and height. The aspect ratio is not preserved. If the flag tfScaleToRect is set, the template is scaled so that both sides fit into the given width and height and the aspect ratio is preserved.
Examples
Import a page as template and use it as content in a table:
Set Variable [$tmpl; Value:MBS("DynaPDF.ImportPageAsTemplate"; $pdf; $i)]
Set Variable [$r; Value:MBS("DynaPDF.Table.SetCellTemplate"; $table; $rowNum; $x; 1; "center"; "center"; $tmpl; 0; 0)]
See also
- DynaPDF.ImportPageAsTemplate
- DynaPDF.Release
- DynaPDF.Table.SetCellAction
- DynaPDF.Table.SetCellImage
- DynaPDF.Table.SetCellImageEx
- DynaPDF.Table.SetCellPadding
- DynaPDF.Table.SetCellSpacing
- DynaPDF.Table.SetCellTable
- DynaPDF.Table.SetCellText
- DynaPDF.Table.SetColorFloat
Example Databases
This function checks for a license.
Created 18th August 2014, last changed 18th October 2016