DynaPDF.Table.SetCellText
-------------------------

Inserts the specified text into the cell.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.5](newinversion35.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.Table.SetCellText"; Table; Row; Col; HAlign; VAlign; Text ) 

**MBS**( **"DynaPDF.Table.SetCellText";** /\* Inserts the specified text into the cell. \*/  
**$Table**; /\* The identifier for the table. \*/   
**$Row**; /\* The row number. Range from 0 to [DynaPDF.Table.GetNumRows](DynaPDFTableGetNumRows.md)-1.e.g. 0 \*/   
**$Col**; /\* The column number. Range from 0 to [DynaPDF.Table.GetNumCols](DynaPDFTableGetNumCols.md)-1.e.g. 0 \*/   
**$HAlign**; /\* The horizontal alignment. Can be left, center or right.e.g. "center" \*/   
**$VAlign**; /\* The vertical alignment. Can be bottom, center or top.e.g. "center" \*/   
**$Text**) /\* The text for the cell.e.g. "Hello World" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Table | The identifier for the table. | $Table |
| Row | The row number. Range from 0 to [DynaPDF.Table.GetNumRows](DynaPDFTableGetNumRows.md)-1. | 0 |
| Col | The column number. Range from 0 to [DynaPDF.Table.GetNumCols](DynaPDFTableGetNumCols.md)-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](DynaPDFConvertStyledText.md) to convert FileMaker styled text.  
  
To avoid line breaks it is possible to set the flag NoLineBreak with [DynaPDF.Table.SetFlags](DynaPDFTableSetFlags.md). 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](DynaPDFTableSetFont.md) and with [DynaPDF.Table.SetFontSize](DynaPDFTableSetFontSize.md). 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\]" &amp; $index &amp; "\\TR\[0\]\\FS\[12\]") \]  
Try with various text scaling commands in the text:

 Set Variable \[ $rowNum ; Value: MBS ("[DynaPDF.Table.AddRow](DynaPDFTableAddRow.md)"; $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](DynaPDFTableAddRow.md)"; $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](DynaPDFTableAddRow.md)"; $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](DynaPDFTableGetNumRows.md)
- [DynaPDF.Table.SetCellPadding](DynaPDFTableSetCellPadding.md)
- [DynaPDF.Table.SetCellSpacing](DynaPDFTableSetCellSpacing.md)
- [DynaPDF.Table.SetCellTable](DynaPDFTableSetCellTable.md)
- [DynaPDF.Table.SetCellTemplate](DynaPDFTableSetCellTemplate.md)
- [DynaPDF.Table.SetColor](DynaPDFTableSetColor.md)
- [DynaPDF.Table.SetColWidth](DynaPDFTableSetColWidth.md)
- [DynaPDF.Table.SetFlags](DynaPDFTableSetFlags.md)
- [DynaPDF.Table.SetFont](DynaPDFTableSetFont.md)
- [FM.Loop](FMLoop.md)

### Example Databases

- [DynaPDF/Book Creation](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Book%20Creation.shtml#3ScriptAnchor_)
- [DynaPDF/Catalog with tables](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Catalog%20with%20tables.shtml#1ScriptAnchor_)
- [DynaPDF/Invoice/Invoice](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Invoice/Invoice.shtml#3ScriptAnchor_)
- [DynaPDF/Merge PDFs](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Merge%20PDFs.shtml#5ScriptAnchor_)
- [DynaPDF/Report](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Report.shtml#1ScriptAnchor_)
- [DynaPDF/Tables](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Tables.shtml#1ScriptAnchor_)

### Blog Entries

- [Merge PDF with table of contents](https://www.mbsplugins.de/archive/2020-02-25/Merge_PDF_with_table_of_conten/monkeybreadsoftware_blog_filemaker)
- [New FM.Loop function](https://www.mbsplugins.de/archive/2018-03-30/New_FMLoop_function/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 10th January 2023

  
[DynaPDF.Table.SetCellTemplate](DynaPDFTableSetCellTemplate.md) - [DynaPDF.Table.SetColOrRowSpan](DynaPDFTableSetColOrRowSpan.md)

[HTML Version](DynaPDFTableSetCellText.shtml)