RTF functions in MBS Plugins
We have a lot of RTF related functions in MBS Xojo Plugins:
- StyledText RTFDataMBS
- DesktopTextArea RTFDataMBS
- DesktopTextArea WinRTFDataMBS
- NSAttributedStringMBS attributedStringWithRTF
- NSAttributedStringMBS attributedStringWithRTFD
- NSAttributedStringMBS initWithRTF
- NSAttributedStringMBS initWithRTFD
- NSAttributedStringMBS rtf
- NSAttributedStringMBS RTFDFileWrapperFromRange
- NSAttributedStringMBS RTFDFromRange
- NSAttributedStringMBS RTFFromRange
- NSTextMBS readRTFDFromFile
- NSTextMBS replaceCharactersInRangeWithRTF
- NSTextMBS replaceCharactersInRangeWithRTFD
- NSTextMBS RTFDFromRange
- NSTextMBS RTFFromRange
- NSTextMBS writeRTFDToFile
- NSTextViewMBS RTFData
- TextArea RTFDataMBS
- TextArea WinRTFDataMBS
Our RTF extension to the Xojo StyledText class is great to speed up loading and saving of StyledText objects. If the styled text belongs to a (Desktop)TextArea, you may use our RTFDataMBS or WinRTFDataMBS functions directly to load and save RTF data. The functions use the OS functions, so they support more styles and font options.
For example if you use WinShowFontPanelMBS to show the Windows font panel or NSFontPanelMBS class for macOS, you may get more font styles than what Xojo supports directly, e.g. double underlined.
Let us show you an example on how to load RTF with our functions:
And other way around to load the RTF:
If you like to insert an image, you can even do that:
Please note that Windows saves the images inline in the RTF file. But macOS uses RTFD files, which need separate handling for loading and saving. But we have plenty of RTFD functions as you see above.
Let us know if you have questions. Or check the RTF Windows example with next plugin version to copy the sample code.