Platforms to show: All Mac Windows Linux Cross-Platform

Back to XLSheetMBS class.

XLSheetMBS.WriteBlank(row as Integer, col as Integer, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes blank cell with specified format.

Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

Some examples using this method:

XLSheetMBS.WriteBoolean(row as Integer, col as Integer, value as boolean, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a bool value into cell with specified format.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteBoolean(2, 5, true, format)

If format is nil then format is ignored.
Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

XLSheetMBS.WriteComment(row as Integer, col as Integer, value as string, author as string, width as Integer, height as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a comment to the cell.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteComment(2, 5, "Sales Worldwide", "Peter", 30, 10)

row and col: cell's position
value: comment string
author: author string
width: width of text box in pixels
height: height of text box in pixels

Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

XLSheetMBS.WriteDate(row as Integer, col as Integer, value as date, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 15.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Writes a date/time into cell with specified format.

If format is nil then format is ignored. Internally uses XLBookMBS.datePack() for packing date/time parts to double.
Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

XLSheetMBS.WriteDateTime(row as integer, col as integer, value as dateTime, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 20.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a date/time into cell with specified format.

If format is nil then format is ignored. Internally uses XLBookMBS.datePack() for packing date/time parts to double.
Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

XLSheetMBS.WriteError(row as Integer, col as Integer, Error as Integer, format as XLFormatMBS = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes error into the cell with specified format.

If format equals nil then format is ignored.

XLSheetMBS.WriteFormula(row as Integer, col as Integer, value as string, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a formula into cell with specified format.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteFormula(2, 5, "SUM(E16:E38)", format)

If format is nil then format is ignored. Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.
As LibXL does not calculate the result of the formula, it will not encode the result in the Excel file. It does only store the formula, so an app opening the file will have to do the calculation. But QuickLook on Mac OS X does not calculate, so results do not show there.
Examples for formulas are: "TODAY()", "IF(C1>0;ABS(C1*D1);"""")", "SUM(E16:E38)" or "E39+E39*E40".

Some examples using this method:

XLSheetMBS.WriteFormulaBool(row as Integer, col as Integer, Expression as string, value as Boolean, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a formula expression with precalculated bool value into cell with specified format.

If format equals nil then format is ignored.
Returns false if error occurs. Get error info with XLBookMBS.errorMessage.

XLSheetMBS.WriteFormulaNum(row as Integer, col as Integer, Expression as string, value as Double, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a formula expression with precalculated double value into cell with specified format.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteFormulaNum(2, 5, "SUM(E16:E38)", 123.45, format)

If format equals nil then format is ignored. Returns false if error occurs. Get error info with XLBookMBS.errorMessage.

XLSheetMBS.WriteFormulaString(row as Integer, col as Integer, Expression as string, value as String, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a formula expression with precalculated string value into cell with specified format.
Example
Var Sheet as XLSheetMBS // your current sheet
Var DollarFormat as XLFormatMBS // the format to use

Var Success as Boolean = Sheet.WriteFormulaNum(2, 5, "SUM(E16:E38)", "$123.45"", DollarFormat)

If format equals nil then format is ignored. Returns false if error occurs. Get error info with XLBookMBS.errorMessage.

XLSheetMBS.WriteNumber(row as Integer, col as Integer, value as Double, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a number or date/time into cell with specified format.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteNumber(2, 5, 123.45, format)

If format is nil then format is ignored. Use XLBookMBS.datePack() for packing date/time parts to double.
Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

Some examples using this method:

XLSheetMBS.WriteRichString(row as integer, col as integer, RichString as XLRichStringMBS, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 20.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a rich string with multiple fonts into the cell with the specified format.

Add a new rich string with the addRichString() method. If format equals nil then format is ignored.
Returns false if an error occurs. Get error info with XLBookMBS.ErrorMessage property.

XLSheetMBS.WriteString(row as Integer, col as Integer, value as string, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a string into cell with specified format.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteString(2, 5, "Hello World", format)

If format is nil then format is ignored.
Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

XLSheetMBS.WriteStringAsNumber(row as integer, col as integer, value as string, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a number into cell with specified format and passes it as text.
Example
Var Sheet as XLSheetMBS // your current sheet
Var format as XLFormatMBS // optional format

Var Success as Boolean = Sheet.WriteStringAsNumber(2, 5, "123.45", format)

Please pass number as text here to avoid running into rounding errors with floating point numbers.

If format is nil then format is ignored. Use XLBookMBS.datePack() for packing date/time parts to double.
Returns false if error occurs. Get error info with XLBookMBS.ErrorMessage property.
Col and Row are zero based.
Please remember that Excel files have limits like 65536 rows and 256 columns.

XLSheetMBS.WriteStyledText(row as integer, col as integer, StyledText as StyledText, format as XLFormatMBS = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XL MBS XL Plugin 20.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Writes a styled text to a cell.

Same as building a rich string based in the StyledText and assigning it to the cell.

We convert attributes like bold, italic, underline, color, font name and size.

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


The biggest plugin in space...