Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.Table.SetCellText
Inserts the specified text into the cell.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
Table | The identifier for the table. | $Table |
Row | The row number. Range from 0 to DynaPDF.Table.GetNumRows-1. | 0 |
Col | The column number. Range from 0 to DynaPDF.Table.GetNumCols-1. | 0 |
HAlign | The horizontal alignment. Can be left, center or right. | "center" |
VAlign | The vertical alignment. Can be bottom, center or top. | "center" |
Text | The text for the cell. | "Hello World" |
Result
Returns OK or error.
Description
Inserts the specified text into the cell.Text is always a foreground object. The cell will be expanded if necessary.
Text can be processed in different ways. By default the text is output with WriteFText. WriteFText supports a lot of format tags. These tags are also supported in a table with exception of a page break tag. You can use DynaPDF.ConvertStyledText to convert FileMaker styled text.
To avoid line breaks it is possible to set the flag NoLineBreak with DynaPDF.Table.SetFlags. The flag is inherited from the table, column, row, and cell, in this order. If set, the text is output with WriteText instead. Since this function doesn't support format tags, the text is processed as plain text.
The font and font size can be set with DynaPDF.Table.SetFont and with DynaPDF.Table.SetFontSize. Note that a table has its own versions of these functions.
If the cell uses a landscape orientation then the text flows to left or to right depending on the orientation and if the flag NoLineBreak is not set. The row height must be set to value greater zero in this case. If the text does not fit into the cell then the column width will be expanded. If the flag NoLineBreak is set, then the height of the row will be expanded if necessary.
If the cell uses a portrait orientation and if the flag NoLineBreak is not set, then text flows from top to bottom or bottom to top, depending on the orientation. The row height will be expanded if necessary. If the flag NoLineBreak is set, then the column width will be expanded if necessary.
Examples
Sets the cell text:
MBS("DynaPDF.Table.SetCellText"; $table; $row; $col; "left"; "top"; Articles::Description1)
Set cell with number in superscript:
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; "\TR[4]\FS[8]" & $index & "\TR[0]\FS[12]") ]
Try with various text scaling commands in the text:
Set Variable [ $rowNum ; Value: MBS("DynaPDF.Table.AddRow"; $table) ]
# try 100% text scaling
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; "\TS[100]Hello World") ]
# now with 80% text scaling
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "left"; "top"; "\TS[80]Hello World\TS[100]") ]
# now with 50% text scaling
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 2; "left"; "top"; "\TS[50]Hello World\TS[100]") ]
Try with various character spacing commands in text:
Set Variable [ $rowNum ; Value: MBS("DynaPDF.Table.AddRow"; $table) ]
# default is zero
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; "\CS[0]Hello World\CS[0]") ]
# now try with 5 pt between characters
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "left"; "top"; "\CS[5]Hello World\CS[0]") ]
# now try with 10 pt between characters
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 2; "left"; "top"; "\CS[10]Hello World\CS[0]") ]
Try with various fonts picked for cell text:
Set Variable [ $rowNum ; Value: MBS("DynaPDF.Table.AddRow"; $table) ]
# Use regular version of AvenirNextCondensed
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; "\FT[AvenirNextCondensed-Regular]AvenirNextCondensed-Regular") ]
# Use bold version of AvenirNextCondensed
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "left"; "top"; "\FT[AvenirNextCondensed-Bold]Hello World") ]
# Use light version of AvenirNextCondensed
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 2; "left"; "top"; "\FT[AvenirNextCondensed-UltraLight]AvenirNextCondensed-UltraLight") ]
See also
- DynaPDF.Table.GetNumRows
- DynaPDF.Table.SetCellPadding
- DynaPDF.Table.SetCellSpacing
- DynaPDF.Table.SetCellTable
- DynaPDF.Table.SetCellTemplate
- DynaPDF.Table.SetColor
- DynaPDF.Table.SetColWidth
- DynaPDF.Table.SetFlags
- DynaPDF.Table.SetFont
- FM.Loop
Example Databases
- DynaPDF/Book Creation
- DynaPDF/Catalog with tables
- DynaPDF/Invoice/Invoice
- DynaPDF/Merge PDFs
- DynaPDF/Report
- DynaPDF/Tables
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 10th January 2023