Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5   8.6    Statistic  

RichText.WriteContainer

Writes current rich text to a container.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
RichText 4.4 Yes No Yes, macOS only No Yes
MBS( "RichText.WriteContainer"; Format { ; FileName } )   More

Parameters

Parameter Description Example value
Format The file format to use. Can be DOC, DOCX or RTF. "DOC"
FileName Optional
The file name to use for the container.
"test.doc"

Result

Returns OK or error.

Description

Writes current rich text to a container.
Please pass format type:
  • doc: creates old style Word document
  • rtf: created rich text file.
  • docx: creates newer Word document.
  • html: creates html file.
  • webarchive: creates html and renders web archive.
  • opendocument: creates open office document.

Warning: The plugin can only read/write the styles/formats which Apple supports for their cocoa framework.

Examples

Read a file, apply replaces and save it:

# load from container
Set Variable [$r; Value:MBS("RichText.ReadContainer"; Replace Text in Word File::InputContainer)]
If [MBS("IsError")]
    Show Custom Dialog ["Error"; "Failed to read file."]
    Exit Script []
End If
# now loop through records to do replaces
Go to Record/Request/Page [First]
Loop
    Set Variable [$r; Value:MBS("RichText.ReplaceText"; Replace Text in Word File::Old Text; Replace Text in Word File::New Text)]
    Go to Record/Request/Page [Next; Exit after last]
End Loop
# write file
Set Field [Replace Text in Word File::OutputContainer; MBS("RichText.WriteContainer"; Replace Text in Word File::format)]
# cleanup
Set Variable [$r; Value:MBS("RichText.Release")]

See also

Example Databases

Blog Entries

Created 16th October 2014, last changed 14th August 2017


RichText.TextLength   -   RichText.WriteDOC

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins