Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/Cocoa/WebViewer save as RTF with images
Function: You find this example project in your Plugins Download as a Xojo (Real Studio) project file within the examples folder: /Cocoa/WebViewer save as RTF with images
Project "WebViewer save as RTF with images.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
End Control
Control saveButton Inherits PushButton
ControlInstance saveButton Inherits PushButton
EventHandler Sub Action() // get styled text dim w as WebViewMBS = HTMLViewer1.WebViewMBS dim f as WebFrameMBS = w.mainFrame dim v as WebFrameViewMBS = f.frameView dim d as WebDocumentViewMBS = v.documentView dim n as NSAttributedStringMBS = d.attributedString // package it dim da as new Dictionary da.Value(n.NSDocumentTypeDocumentAttribute) = n.NSRTFDTextDocumentType dim e as NSErrorMBS dim fw as NSFileWrapperMBS = n.fileWrapperFromRange(0, n.Length, da, e) if e <> nil then MsgBox e.LocalizedDescription Return end if // write to disk dim file as FolderItem = SpecialFolder.Desktop.Child("test.rtfd") if fw.writeToFile(file, e) then MsgBox "OK" else MsgBox e.LocalizedDescription end if End EventHandler
End Control
EventHandler Sub Open() HTMLViewer1.LoadURL "http://www.mbsplugins.de" End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

Feedback, Comments & Corrections




Links
MBS FileMaker Plugins