Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/WebViewer save as RTF with images
Function:
Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/WebViewer save as RTF with images
This example is the version from Wed, 12th Jan 2016.
Function:
Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/WebViewer save as RTF with images
This example is the version from Wed, 12th Jan 2016.
Project "WebViewer save as RTF with images.xojo_binary_project"
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
The items on this page are in the following plugins: MBS MacCocoa Plugin.
Feedback: Report problem or ask question.