Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

WordFile.AppendTableRow

Duplicates and appends a table row containing a placeholder.

Component Version macOS Windows Linux Server iOS SDK
WordFile 7.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "WordFile.AppendTableRow"; WordFile; Placeholder )   More

Parameters

Parameter Description Example
WordFile The reference number of the open word file. $wordFile
Placeholder The name of the placeholder. "City"

Result

Returns OK or error.

Description

Duplicates and appends a table row containing a placeholder.
If you have tables in your template word file and you like to duplicate rows and add them to the end of the table, just call this function with a placeholder field in that row. The place holder in the document must start with « and end with » characters.

Use WordFile.AppendTableRow to add new row to the end or WordFile.DuplicateTableRow to add it after the referenced one.

Examples

Add two lines and remove template line:

# load from container
Set Variable [ $wordfile ; Value: MBS( "WordFile.OpenContainer"; WordFile::Input ) ]
If [ MBS("ISError") ]
    Show Custom Dialog [ "Error" ; $wordFile ]
    Exit Script [ Text Result: ]
End If
#
# add table row and fill in data
Set Variable [ $r ; Value: MBS( "WordFile.AppendTableRow"; $WordFile; "TName") ]
Set Variable [ $r ; Value: MBS( "WordFile.ReplaceTag"; $WordFile; "TName"; "Brochure 123") ]
Set Variable [ $r ; Value: MBS( "WordFile.ReplaceTag"; $WordFile; "TDescription"; "Restaurant Recommendations") ]
#
# add table row and fill in data
Set Variable [ $r ; Value: MBS( "WordFile.AppendTableRow"; $WordFile; "TName") ]
Set Variable [ $r ; Value: MBS( "WordFile.ReplaceTag"; $WordFile; "TName"; "Brochure 456") ]
Set Variable [ $r ; Value: MBS( "WordFile.ReplaceTag"; $WordFile; "TDescription"; "Hotel Recommendations") ]
#
# remove last row left
Set Variable [ $r ; Value: MBS( "WordFile.RemoveTableRow"; $WordFile; "TName") ]
#
# write to desktop
Set Variable [ $DesktopPath ; Value: MBS("Folders.UserDesktop") ]
Set Variable [ $FilePath ; Value: MBS( "Path.AddPathComponent"; $DesktopPath; "test output.docx" ) ]
Set Variable [ $r ; Value: MBS( "WordFile.WriteFile"; $WordFile; $FilePath ) ]
Set Variable [ $r ; Value: MBS( "Files.LaunchFile"; $FilePath ) ]
# clean up
Set Variable [ $r ; Value: MBS("WordFile.Release"; $WordFile) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 26th January 2017, last changed 18th November 2021


WordFile.Append - WordFile.Contains