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/List Hyperlinks
This example is the version from Sun, 20th Jan 2018.
Project "List Hyperlinks.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
RegisterLibXL
// select a file and open it
dim book as XLBookMBS
dim tab as string = encodings.ASCII.Chr(9)
dim file as FolderItem = GetOpenFolderItem(FileTypes1.All)
if file = nil then quit
if right(file.Name,4) = ".xls" then
book = new XLBookMBS(false)
elseif Right(file.Name,5)=".xlsx" then
book = new XLBookMBS(true)
else
MsgBox "Unknown file extension!"
quit
end if
// Warning: Without a license the plugin will read only 100 cells (first row is unavailable)
// book.SetKey("...", "...")
if book.Load(file) then
// now write all values from all sheets to text file
dim f as FolderItem = SpecialFolder.Desktop.Child("test.txt")
dim t as TextOutputStream = f.CreateTextFile
for each sheet as XLSheetMBS in book.Sheets
t.WriteUTF8 "Sheet: "+sheet.Name
t.WriteLine
dim u as integer = sheet.HyperlinkSize-1
for i as integer = 0 to u
dim rowFirst as integer, rowLast as integer, colFirst as integer, colLast as integer
dim URL as string = sheet.Hyperlink(0, rowFirst, rowLast, colFirst, colLast)
t.WriteLine URL
t.WriteLine str(rowFirst)+":"+str(colFirst)+" to "+str(rowLast)+":"+str(colLast)
t.WriteLine
next
next
t.Close
f.Launch
else
MsgBox 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
FileTypes1
Filetype application/vnd.ms-excel
Filetype excel
Filetype excel xml
End FileTypes1
Module Module1
Sub WriteUTF8(extends t as TextOutputStream, s as string)
t.Write ConvertEncoding(s, encodings.UTF8)
End Sub
End Module
End Project
The items on this page are in the following plugins: MBS XL Plugin.