Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS XL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /XL/Styled Text
This example is the version from Fri, 23th Apr 2020.
Project "Styled Text.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
RegisterLibXL
// create new xls file
dim book as new XLBookMBS(false)
// create sheet
Dim sheet As XLSheetMBS = book.AddSheet("StyledText")
// write some values
// first build some styled text and pass it to WriteStyledText function
// but you probably pass directly from textarea
Dim st As New StyledText
Dim row As Integer = 2
Dim col As Integer = 0
st.Text = "Red Text blue"
st.TextColor(0, 8) = &cFF0000
st.TextColor(9, 4) = &c0000FF
st.Size(0,4) = 15
Call sheet.WriteStyledText row, col, st
row = 3
st = New StyledText
st.Text = "Hello World from Xojo"
st.Italic(0,11) = True
st.Bold(0,11) = True
st.Underline(0,11) = True
st.Font(0,11) = "Calibri"
st.Bold(12,10) = True
Call sheet.WriteStyledText row, col, st
// write file
Dim file As FolderItem = SpecialFolder.Desktop.Child("StyledText.xls")
if book.Save(file) then
file.Launch
else
MsgBox "Failed to create file."+EndOfLine+EndOfLine+book.ErrorMessage
end if
quit
End EventHandler
Sub RegisterLibXL()
// once you bought a LibXL license, you can put your license key here
// see order links on our website
// http://www.monkeybreadsoftware.de/xojo/plugin-xls.shtml
#if TargetMacOS then
XLBookMBS.SetKeyGlobal "your name", "your Mac LibXL license key"
#elseif TargetWin32 then
XLBookMBS.SetKeyGlobal "your name", "your Windows LibXL license key"
#elseif TargetLinux then
XLBookMBS.SetKeyGlobal "your name", "your Linux LibXL license key"
#endif
End Sub
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 XL Plugin.