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: 10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4    Statistic    FMM    Blog  

WordFile.AppendTableRow

Duplicates 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 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

Created 26th January 2017, last changed 30th September 2019


WordFile.Append - WordFile.DuplicateTableRow

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins

Start Chat