Platforms to show: All Mac Windows Linux Cross-Platform

Back to XLBookMBS class.

XLBookMBS.Save(path as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves current workbook into xls-file.
Example
// create new Excel file, pass true for XLSX format or false for older XLS format
Var book As New XLBookMBS(True)

// add sheet
Var sheet As XLSheetMBS = book.addSheet("Test")
Call sheet.WriteString(2, 1, "Hello World", Nil)

// write file and launch
Var file As FolderItem = SpecialFolder.Desktop.Child("Writing data.xlsx")

If book.Save(file) Then
file.Launch
Else
MessageBox "Failed to create file."+EndOfLine+EndOfLine+book.ErrorMessage
End If

Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.

See also:

XLBookMBS.Save(path as folderitem, UseTempFile as Boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 17.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves current workbook into the file.

Use a temporary file for reducing memory consumption.
Returns false if error occurs or true on success. Get error info with errorMessage function.

See also:

XLBookMBS.Save(path as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves current workbook into xls-file.

Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.

See also:

XLBookMBS.Save(path as string, UseTempFile as Boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 17.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves current workbook into the file.

Use a temporary file for reducing memory consumption.
Returns false if error occurs or true on success. Get error info with errorMessage function.

See also:

XLBookMBS.SaveMT(path as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves document to file on disk.

Same as the other method without MT in name, except:

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

See also:

XLBookMBS.SaveMT(path as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves document to file on disk.

Same as the other method without MT in name, except:

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

See also:

XLBookMBS.SaveRaw(byref data as MemoryBlock) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 14.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves a xls-file to internal memory buffer.

Returns false if error occurs. Get error info with errorMessage property.

See also:

Some examples using this method:

XLBookMBS.SaveRaw(byref data as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves a xls-file to internal memory buffer.

Returns false if error occurs. Get error info with errorMessage property.

See also:

XLBookMBS.SaveRawMT(byref data as MemoryBlock) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves document to memoryblock.

Same as the other method without MT in name, except:

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

See also:

XLBookMBS.SaveRawMT(byref data as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves document to string.

Same as the other method without MT in name, except:

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

See also:

XLBookMBS.SetDefaultFont(fontName as string, fontSize as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets a default font name and size for this workbook.

XLBookMBS.SetKey(name as string, key as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets customer's license key.

Call this once for each XLBookMBS object and before you read or write data.

If you have keys for more than one platform, please use #if condition to make sure you pass right key for current platform.

XLBookMBS.SetKeyGlobal(name as string, key as string)   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 18.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Private method to avoid you call this on an object.

Please call shared method in app.open.
Because if you make a new object and set key, it's too late.

See also:

XLBookMBS.SetLocale(locale as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the locale.
Example
Var book as new XLBookMBS(false)
book.SetLocale "en_US.UTF-8"

Sets the locale for this library. It has no effect for unicode projects.

XLBookMBS.SetPassword(Password as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 26.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the password for reading an encrypted book.
Example
var file as new FolderItem("test.xlsx")
Var doc As New XLBookMBS(True)

doc.SetPassword "secret"

If doc.Load(file) Then
MessageBox "Okay"
Else
MessageBox "Failed to load"+EndOfLine+EndOfLine+doc.ErrorMessage
End If

Must be called on the book before calling the load functions.

XLBookMBS.Sheet(index as Integer) as XLSheetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the sheet with specified index.

Returns nil if error occurs. Get error info with XLBookMBS.ErrorMessage property.

XLBookMBS.SheetCount as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns a number of sheets in this book.

Some examples using this method:

XLBookMBS.SheetName(index as integer) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 26.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the name of the sheet.

To be used with the LoadInfo functions.

XLBookMBS.Sheets as XLSheetMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns array with all sheets.
Example
Function SheetByName(book as XLBookMBS, name as string) As XLSheetMBS
Var sheets() as XLSheetMBS = book.Sheets
for each s as XLSheetMBS in sheets
if s.Name = name then
Return s
end if
next
End Function

Some examples using this method:

XLBookMBS.SheetType(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 13.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries type of the sheet.

The items on this page are in the following plugins: MBS XL Plugin.


The biggest plugin in space...