Scripting: Interfaces and methods

Registering scripting interfaces

To be able to use scripting, you must register the scripting interfaces in the Windows registry database. To do this, run GS-Calc as an administrator (e.g. right-click GS-Calc shortcut/icon and on the context menu choose "Run as administrator") and use the Settings > Register Scripting Interfaces command.
Similarly, if you no longer need scripting, you can use the Settings > Unregister Scripting Interfaces command to remove all registry entries added earlier. Uninstalling GS-Calc will unregister those interfaces as well.

Creating scripts

You can create your scripts either as global scripts saved in the program settings and available to all databases or you can create scripts stored in a given GS-Calc workbook and available only after you open that workbook.
To create these scripts use the "File > Application Scripts" and "File > Database Scripts" commands.

The "(...) Scripts" dialog box enables you to organize your scripts in subfolders, test them to locate errors, copy/import/export them etc.

Sample "Scripts" screen.

Notes:

Interfaces provided by GS-Calc


XBaseParams

format

A string specifying the xBase file format:

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.format = "dbaseIV";
	

encoding

A string specifying the character encoding in the xBase file:

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.encoding = "dos";
	

GetFieldCount()

Returns the number of defined database fields.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	var counter = GetFieldCount();
	

SetField(index, name, type, length, decimals)

AddField(name, type, length, decimals)

InsertField(index, name, type, length, decimals)

Update the name and type of an existing database fields.

index

One-based field index.

name

A field name consisting of up to 10 characters.

type

A string specifying any of the xBase field types:

length

The field length. The specified value is used only the "C" field (up to 65534 for FoxPro and up to 254 otherwise) and the "N"/"F" fields.
The length of other fields are fixed and can't be changed.

decimals

The number of decimal places in the "N" fields.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("item", "C", 40, 0);
	xBaseParams.AddField("price", "N", 5, 2);
	xBaseParams.SetField(1, "item", "C", 50, 0);
	

GetFieldName(index)

Returns the name of a given database field.

index

A one-based index of the field.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	var name = GetFieldName(1); // returns "name"
	

GetFieldType(index)

Returns the type of a given database field.

index

A one-based index of the field.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	var name = GetFieldType(1); // returns "C"
	

GetFieldLength(index)

Returns the length of a given database field.

index

A one-based index of the field.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	var name = GetFieldLength(1); // returns 40
	

GetFieldDecimals(index)

Returns the length of a given numeric ("N") database field.

index

A one-based index of the field.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	var name = GetFieldLength(1); // returns 40
	

DeleteField(index)

Deletes a given database field.

index

A one-based index of the field.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.AddField("first_name", "C", 40, 0);
	xBaseParams.AddField("last_name", "C", 40, 0);
	xBaseParams.AddField("street", "C", 40, 0);
	xBaseParams.AddField("city", "C", 40, 0);
	var name = DeleteField(3);
	

TextParams

separator

Specifies a character separatoring columns in a text file.

Example:

	var textParams1 = GSCalc.CreateTextParams();
	textParams1.separator = "\t"; // tab-separeted values
	var textParams2 = GSCalc.CreateTextParams();
	textParams2.separator = ","; // command-separated values
	

encoding

A string specifying the character encoding in the text file:

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.encoding = "utf8";
	

quotingSymbol

Specifies a character used to quote values containing column/value separators. The inner quoting symbols are doubled.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.quotingSymbol = "\"";
	

loadNumbers

A logical value specifying whether strings representing unformatted numbers should be converted to numbers. If the value is set to false, a text file will be open/saved faster and all worksheet cells will be text cells.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.loadNumbers = true;
	

loadFmtNumbers

A logical value specifying whether strings representing formatted numbers should be converted to numbers. If the value is set to false, a text file will be open/saved faster and formatted numbers will become text cells.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.loadFmtNumbers = true;
	

loadDates

A logical value specifying whether strings representing date/time values should be converted to date serial numbers. If the value is set to false, a text file will be open/saved faster and date strings will become text cells.
If the date data is to be sorted correctly, it must be converted to date serial numbers.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.loadDates = false;
	

loadDateStyles

A logical value specifying whether styles of the date/time values converted to date serial numbers should be preserved in the opened worksheet. If the value is set to false, cells containing date serial numbers will be displaying them as numbers.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.loadDateStyless = false;
	

parsingMode

A value specifying if and how possible formulas should be parsed when opening a text file:

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.parsingMode = 3;
	

columnWidths

A string specifying fixed column/value widths in the text file. Setting this value overwrites previously defined column/value separator. If a text file line contains more characters than the specified widths, the remaining ones will be forming subsequent max-1024-character fields.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.columnWidths = "10, 30, 15, 20";
	

saveFmtNumbers

A logical value specifying whether numbers from formatted cells shoud be saved as formatted numbers or as as generic non-formatted numbers (e.g. 1,123.10 vs 1123.1).

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.saveFmtNumbers = false;
	

saveFmtDates

A logical value specifying whether formatted dates (serial numbers and generic date/time strings) should be saved as the resulting formatted strings.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.saveFmtDates = true;
	

saveFormulaValues

A logical value specifying whether formulas values should be saved in a text file. If it's set to "false", the very formulas will be saved instead.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.saveFormulaValues = false;
	

autoFitCols

A logical value specifying whether after opening a given file columns should be automatically resized to fit their contents. Note: specifying 1/true will result in additional calculations after opening that file which may the entire opening process slightly longer.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.autoFitCols = false;
	

MergeParams

A set of parameters used by rows-merging functions.


FormatParams

dataStyleName

A string specifying the predefined data style name:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.dataStyleName = "Currency";
	

SetGeneralNumberFormat(decimals, zeroes, brackets, inRed, separators, scaling)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto"
zeroes
The number of leading zeroes. This can be any number from 0 to 14.
Default value: 1
brackets
A logical value specifying whether negative numbers should be enclosed in brackets.
Default value: false
inRed
A logical value specifying whether negative numbers should be displayed in red.
Default value: false
separators
A logical value specifying whether thousand separators should be used.
Default value: false
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetGeneralNumberFormat(4, 1, false, false, false, 0);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetCurrencyFormat(decimals, position, symbol, brackets, inRed, scaling)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto" (=2)
position
A string specifying the position of the currency symbol:

Default value: "$1.1"
symbol
A string specifying the currency symbol.
Default value: "$"
brackets
A logical value specifying whether negative numbers should be enclosed in brackets.
Default value: false
inRed
A logical value specifying whether negative numbers should be displayed in red.
Default value: false
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetCurrencyFormat(0, "$1.1", "$", false, false, 0);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetAccountingFormat(decimals, symbol, scaling)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto" (=2)
symbol
A string specifying the currency symbol.
Default value: "$"
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetAccountingFormat(0, "$", 0);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetDateFormat(pattern, systemOrder)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. pattern
A string specifying the date format:
"m/d/yyyy", "mm/dd/yyyy", "m/d/yy", "mm/dd/yy", "m/d", "mm/yy", "mmm-d", "mmm-d-yyyy", "mmm-d-yy" "mmmm d, yyyy", "dddd, mmmm dd, yyyy".
Default value: "m/d/yyyy"
systemOrder
A logical value specifying whether day-month display order should be determined by the current system settings.
Default value: true

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetDateFormat("m/d", true);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetTimeFormat(pattern)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. pattern
A string specifying the date format:
"h:mm", "h:mm AM/PM", "hh:mm", "hh:mm AM/PM", "h:mm:ss", "h:mm:ss AM/PM", "hh:mm:ss", "hh:mm:ss AM/PM", "[m]:ss.00", "[h]:mm:ss", "[d] hh:mm"
Default value: "h:mm"

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetTimeFormat("hh:mm AM/PM");
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetDateTimeFormat(datePattern, timePattern, systemOrder, timeFirst)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. The meaning of first three arguments is the same as in SetDateFormat and SetTimeFormat methods listed above.
timeFirst
A logical value specifying whether the time string should precede the date string.
Default value: false

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetDateTimeFormat("m/d","hh:mm AM/PM", true, false);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetPercentFormat(decimals, scaling)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto"
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetPercentFormat(0, 0);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetFractionFormat(denominator, digits)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. denominator
If digits is true, this argument specifies the fixed number of denominator digits.
If digits is false, this argument specifies the fixed denominator value.
Default value: digits: false, denominator: 1

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetFractionFormat(2, false);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

SetScientificFormat(decimals, exponent)

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number between 0 and 14.
Default value: "auto"
exponent
The value of the exponent. This can be "auto" or any number between -99 and 99.
Default value: "auto"

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.SetScientificFormat("auto", 12);
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

fontName

A string specifying the font name. To specify the default font name, use an empty string.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.fontName = "Tahoma";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

fontSize

The size of the font in points. To specify the default size, use zero.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.fontSize = 8;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

language

A string specifying the language related to the font. This is a standard language code typically consisting of the country-language pair, eg: en-US, en-GB, en-AU, de-DE, de-AU, es-ES, pl-PL, ru-RU etc.
If the submitted string is invalid, it'll default to en-US.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.language = "en-GB";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

boldFont

Toggles the "bold" font attribute on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.boldFont = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

italicFont

Toggles the "italic" font attribute on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.italicFont = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

underlineFont

Toggles the "underline" font attribute on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.underlineFont = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

strikeoutFont

Toggles the "strikeout" font attribute on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.strikeoutFont = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

fontColor

Specifies the font color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.fontColor = "#FF0000";
	formatParams.fontColor = "green";
	formatParams.fontColor = "auto";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

horzAlignment

Specifies the horizontal text alignment in cells. Accepted values are the following strings:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.horzAlignment = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

vertAlignment

Specifies the vertical text alignment in cells. Accepted values are the following strings:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.vertAlignment = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

horzIndent

Specifies the horizontal text indent in cells. Accepted values are between 0 and 255. The default value is 4.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.horzIndent = 4;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

vertIndent

Specifies the vertical text indent in cells. Accepted values are between 0 and 255. The default value is 2.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.vertIndent = 1;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

wrapText

A logical value that toggles wrapping text in cells on/off. Setting this property to true automatically sets the shrinkText property to false.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.wrapText = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

shrinkText

A logical value that toggles shrinking text that overflows the width of the cells on/off. Setting this property to true automatically sets the wrapText property to false.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.shrinkText = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

textRotation

Specifies the rotation of the text in cells. Acceptable values are from -90 to 90 degrees.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.textRotation = 25;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

hideFormula

A logical value that toggles hiding formulas on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.hideFormula = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

protectedCell

A logical value that toggles cell protection on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.protectedCell = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

printedCell

A logical value that toggles printing cell contents on/off.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.printedCell = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

borderStyle

Specifies the cell border style. The following style names are accepted:

Specifying "none" remove all borders around the cell.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.borderColor = "green";
	formatParams.borderPosition = 15;
	formatParams.borderStyle = "solid";
	formatParams.borderWidth = 1;
	formatParams.borderDoubleLine = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

borderWidth

Specifies the cell border width. Accepted values are from 1 to 16 logical pixels.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.borderColor = "green";
	formatParams.borderPosition = 15;
	formatParams.borderStyle = "solid";
	formatParams.borderWidth = 1;
	formatParams.borderDoubleLine = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

borderDoubleLine

A logical value that toggles displaying double borders.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.borderColor = "green";
	formatParams.borderPosition = 15;
	formatParams.borderStyle = "solid";
	formatParams.borderWidth = 1;
	formatParams.borderDoubleLine = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

borderColor

Specifies the cell border color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.borderColor = "green";
	formatParams.borderPosition = 15;
	formatParams.borderStyle = "solid";
	formatParams.borderWidth = 1;
	formatParams.borderDoubleLine = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

borderPosition

Specifies the cell border color. The following numeric values and their combinations are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.borderColor = "green";
	formatParams.borderPosition = 15;
	formatParams.borderStyle = "solid";
	formatParams.borderWidth = 1;
	formatParams.borderDoubleLine = true;
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

bkgColor

Specifies the cell background color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.bkgColor = "#FF0000";
	formatParams.bkgColor = "green";
	formatParams.bkgColor = "auto";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

bkgImageName

Specifies the cell background image. The name must represent an image available via the workbook list of images (see: "Cell Format > Background > Images").

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.bkgImageName = "blue-sphere.png";
	formatParams.bkgImageOpacity = 100;
	formatParams.bkgImageHorzPos = "left";
	formatParams.bkgImageVertPos = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

bkgImageRepeatt

Specifies how the cell background image should be displayed within the cell. The following text strings values are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.bkgImageName = "blue-sphere.png";
	formatParams.bkgImageRepeat = "repeat";
	formatParams.bkgImageOpacity = 100;
	formatParams.bkgImageHorzPos = "left";
	formatParams.bkgImageVertPos = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

bkgImageHorzPos

Specifies the horizontal position of the cell background image. The following text string values are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.bkgImageName = "blue-sphere.png";
	formatParams.bkgImageHorzPos = "right";
	formatParams.bkgImageOpacity = 100;
	formatParams.bkgImageHorzPos = "left";
	formatParams.bkgImageVertPos = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

bkgImageVertPos

Specifies the vertical position of the cell background image. The following text string values are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.bkgImageName = "blue-sphere.png";
	formatParams.bkgImageVertPos = "top";
	formatParams.bkgImageOpacity = 100;
	formatParams.bkgImageHorzPos = "left";
	formatParams.bkgImageVertPos = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

bkgImageOpacity

Specifies the cell background image opacity. This is numeric value between 0 (a fully transparent image) to 100 (a fully opaque image).

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.bkgImageName = "blue-sphere.png";
	formatParams.bkgImageVertPos = "top";
	formatParams.bkgImageOpacity = 70;
	formatParams.bkgImageHorzPos = "right";
	formatParams.bkgImageVertPos = "center";
	wsheet.selectedRange = "d4";
	wsheet.SetCellFormat(formatParams);
	

Reset()

Resets the FormatParams object and initiates it with default or empty attributes.
When using such an object with the formatting method of the Worksheet object, only submitting explicitly a given FormatParams property triggers a corresponding formatting action. For example, the following code:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.boldFont = true;
	formatParams.italicFont = true;
	wsheet.selectedRange = "b10:b20";
	wsheet.SetCellFormat(formatParams);
	

is an equivalent to clicking the "Bold" toolbar button, then the "Italic" format button. If the following code re-use the same FormatParams object without resetting:

	formatParams.dataStyleName = "Currency";
	wsheet.selectedRange = "b10:b20";
	wsheet.SetCellFormat(formatParams);
	

it will be an equivalent to clicking the "Bold" toolbar button, then the "Italic" format button, then choosing the "Currency" style.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.Reset();
	

PrintSettings

printedData

Specifies which data are to be printed. The following text string values are accepted:

"All" is the default value.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printedData = "all";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

printedPages

Specifies the range of printed pages as a comma-separated list of pages and page ranges.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printedData = "pages";
	printSettings.printedPages = "1,3,5-8";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

orientation

Specifies the printed pages orientation. The following text string values are accepted:

"Portrait" is the default value.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.orientation = "landscape";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

horzPageAlign

Specifies the horizontal alignment of the printed pages. The following text string values are accepted:

The default value is "left".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.horzPageAlign = "center";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

vertPageAlign

Specifies the vertical alignment of the printed pages. The following text string values are accepted:

The default value is "top".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.vertPageAlign = "center";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

marginLeft

Specifies the left printed page margin in mm. The default value is an equivalent to 0.5".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.marginLeft = 6;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

marginTop

Specifies the top printed page margin in mm. The default value is an equivalent to 0.8".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.marginTop = 6;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

marginRight

Specifies the right printed page margin in mm. The default value is an equivalent to 0.5".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.marginRight = 6;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

marginBottom

Specifies the bottom printed page margin in mm. The default value is an equivalent to 1.1".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.marginBottom = 6;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

headerMargin

Specifies in mm the margin between the header and the top edge of the printed page. The default value is an equivalent to 0.1".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.headerMargin = 6;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

footerMargin

Specifies in mm the margin between the footer and the bottom edge of the printed page. The default value is an equivalent to 0.1".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.footerMargin = 6;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

header

Specifies the header text. The header can contain special content fields and alignment controlling codes. For more information, please see the documentation/help for the "Print" dialog box.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.header = "&c Document: &f";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

footer

Specifies the footer text. The footer can contain special content fields and alignment controlling codes. For more information, please see the documentation/help for the "Print" dialog box.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.header = "&c &p";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

scale

Specifies the printing scale. The valid values are from 10% to 999%.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.scale = 120;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

autoFit

A logical value specifying whether the printed worksheet data should be shrunk to fit the page.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.autoFit = true;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

printHeadings

A logical value specifying whether the (table) row and column headings should be printed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printHeadings = true;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

printObjects

A logical value specifying whether objects (charts and images) should be printed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printObjects = true;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

printGrid

A logical value specifying whether gridlines should be printed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printGrid = true;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

printFormulas

A logical value specifying whether cells containing formulas should be printed (either as their values or the very formulas).

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printFormulas = true;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

printZeroes

A logical value specifying whether zero cell values should be printed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.printZeroes = true;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

bkgColor

Specifies the page background color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.bkgColor = "#FDFDFD";
	//printSettings.bkgColor = "gray";
	//printSettings.bkgColor = "auto";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

bkgImageName

Specifies the page background image. The name must represent an image available via the workbook list of images (see: "Cell Format > Background > Images").

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.bkgImageName = "blue-sphere.png";
	printSettings.bkgImageOpacity = 100;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

bkgImageRepeat

Specifies how the page background image should be displayed within the page. The following text strings values are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.bkgImageName = "blue-sphere.png";
	printSettings.bkgImageRepeat = "repeat";
	printSettings.bkgImageOpacity = 100;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

bkgImageHorzPos

Specifies the horizontal position of the page background image. The following text string values are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.bkgImageName = "blue-sphere.png";
	printSettings.bkgImageOpacity = 100;
	printSettings.bkgImageHorzPos = "right";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

bkgImageVertPos

Specifies the vertical position of the page background image. The following text string values are accepted:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.bkgImageName = "blue-sphere.png";
	printSettings.bkgImageOpacity = 100;
	printSettings.bkgImageVertPos = "center";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

bkgImageOpacity

Specifies the page background image opacity. This is numeric value between 0 (a fully transparent image) to 100 (a fully opaque image).

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	wsheet.GetPrintSettings(printSettings);
	printSettings.bkgImageName = "blue-sphere.png";
	printSettings.bkgImageOpacity = 50;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

Worksheet

selectedRange

Specifies the current cell range selection.

After selecting a new range, the corresponding active worksheet will be scrolled to ensure that range (or at least its top-left cell) is visible.
Setting a selection automatically de-select any currently selected objects.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "c20";
	wsheet.UpdateWindows();
	GSCalc.Sleep(2000);
	wsheet.selectedRange = "c20:d22";
	wsheet.UpdateWindows();
	GSCalc.Sleep(2000);
	wsheet.selectedRange = "2:2";
	wsheet.UpdateWindows();
	GSCalc.Sleep(2000);
	wsheet.selectedRange = "H:I";
	

topLeftCell

Specifies the top-left cell of the worksheet window.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.topLeftCell = "c20";
	

Scroll(type, scrollSelection)

Scrolls the worksheet view. If scrollSelection is false, calling this method corresponds to dragging the scroll boxes of the view scrollbars (and to pressing scrolling keys with the "Scroll Lock" key on.
If scrollSelection is false (and the "Scroll Lock" key off), calling this method corresponds to pressing the cursor keys.
Unlike other methods, Scroll enforces screen updates during the excecution of the script so UpdateWindow() doesn't have to be used.

The type argument can be of the following text strings:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var i;
	for ( i = 0; i < 50; ++i )
	{
		wsheet.Scroll("line-down", true);
		GSCalc.Sleep(200);
	}
	

Address(column, row)

Creates and returns and a string representing the specified relative cell address.
To obtain only the column or row name/number, specify 0 as the 2nd argument.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver cell = wsheet.Address(3, 20); // returns "C20"
	ver cell2 = wsheet.Address(3, 0); // returns "C"
	

AddressEx(column, relativeColumn, row, relativeRow)

Creates and returns and a string representing the specified relative or absolute cell address, depending on the logical relativeColumn and relativeRow arguments.
To obtain only the column or row name/number, specify 0 as the 2nd argument.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver cell = wsheet.AddressEx(3, true, 20, false); // returns "C$20"
	ver cell = wsheet.AddressEx(3, false, 0, false); // returns "$C"
	

Column(cell)

Returns the column number of the specified cell address.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver column = wsheet.Column("C20"); // returns 3
	

Row(cell)

Returns the column number of the specified cell address.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver column = wsheet.Column("C20"); // returns 20
	

GetFirstColumn()

Returns the number of the first non empty column.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver column = wsheet.GetFirstColumn();
	

GetFirstRow()

Returns the number of the first non empty row.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver row = wsheet.GetFirstRow();
	

GetLastColumn()

Returns the number of the last non empty column.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver column = wsheet.GetLastColumn();
	

GetLastRow()

Returns the number of the last non empty row.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver row = wsheet.GetLastRow();
	

GetMaxColumn()

Returns the maximum column number.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver column = wsheet.GetMaxColumn();
	

GetMaxRow()

Returns the maximum row number.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	ver row = wsheet.GetMaxRow();
	

CreateFormatParams()

Creates and returns an object containing cell formatting parameters. The FormatParams object is then used to retrieve existing cell formats and to set new ones.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.boldFont = true;
	formatParams.italicFont = true;
	wsheet.selectedRange = "b1:b20";
	wsheet.SetCellFormat(formatParams);
	

GetCellFormat(formatParams)

Retrieves a cell format for the selected cell or range. The corresponding column or row format is ignored and must be obtained using the GetColumnFormat() and GetRowFormat() methods.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	wsheet.selectedRange = "b10:b20";
	wsheet.GetCellFormat(formatParams);
	

GetColumnFormat(formatParams)

Retrieves a column format relative to the seleted cell or range.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	wsheet.selectedRange = "b10:b20";
	wsheet.GetColumnFormat("b10:b20", formatParams);
	

GetRowFormat(formatParams)

Retrieves a row format relative to the selected cell or range.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	wsheet.selectedRange = "b10:b20";
	wsheet.GetRowFormat(formatParams);
	

SetCellFormat(formatParams)

Formats the selected cell or range of cells using formatting attributes set in the FormatParams object. If the range doesn't include any complete columns or rows, the formatting will be applied to subsequent individual cells.
If the selected range specifies a column selection (e.g. c1:c12582912, h1:12582912, c:c, c:h), the formatting will be applied to whole columns.
If the selected range specifies a row selection (e.g. a10:fan10, 1:1, 4:6), the formatting will be applied to whole rows.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var formatParams = wsheet.CreateFormatParams();
	formatParams.boldFont = true;
	formatParams.italicFont = true;
	wsheet.selectedRange = "b10:b20";
	wsheet.SetCellFormat(formatParams);
	

SetCellCustomStyle(name)

Formats the selected cell or a range of cells using a user-defined custom cell style/format. Cell styles can be added, edited and deleted via the "Format > Custom Cell Styles" dialog box or via the "Format > Cell Format" dialog box.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b10:b20";
	wsheet.SetCellCustomStyle("cell style 1.");
	

DeleteCells(showDialogBox, contentType)

Deletes selected cell(s). The showDialogBox argument is a logical value that specifies whether the Delete dialog box should be displayed.
The contentType argument is a text string specifying the type of the deleted data. It can be any combination of the

The data option is an equivalent to "number, labels, formulas".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "c10:c20";
	wsheet.DeleteCells(false, "data");
	wsheet.selectedRange = "d10";
	wsheet.DeleteCells(false, "formatting");
	wsheet.selectedRange = "b4";
	wsheet.DeleteCells(true, "formatting, lists, comments");
	

CopyCells(copyType)

Copies selected cell(s).The contentType argument is a numeric 0-7 value specifying the type of the copy action:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "c10:c20";
	wsheet.CopyCells(0);
	wsheet.selectedRange = "d10";
	wsheet.PasteCells(true);
	wsheet.selectedRange = "b4";
	wsheet.CopyCells(0);
	wsheet.selectedRange = "b5";
	wsheet.PasteCells(true);
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	// ...
	

PasteCells(textAndFormatting)

Pastes previously copied cell(s) or the textual data from the Clipboard. The textAndFormatting argument is a logical value specifying whether the copied cells should be pasted along with their formatting.
If the current selection is a single cell, the copied and pasted data block will be the same. If the current selection spans multiple rows and/or columns, the pasted data will be duplicated, filling the selected range if it's bigger than the source range.

Executing a large number of the PasteCells actions will be faster if the updateMode property is set to manual and the application/workbook window is minimized.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "c10:c20";
	wsheet.CopyCells(0);
	wsheet.selectedRange = "d10";
	wsheet.PasteCells(true);
	wsheet.selectedRange = "b4";
	wsheet.CopyCells(0);
	wsheet.selectedRange = "b5:b10";
	wsheet.PasteCells(true);
	

GetColumnWidth()

Returns width of the current column (a column related to the top-left cell of the selection) in pixels. The width is calculated for the view scale = 100%. If the column width is automatic, the "auto" string is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var width = wsheet.GetColumnWidth();
	

SetColumnWidth(width)

Sets the width for the columns included in the currently selected range. The width argument is a text string that can represent either a width in pixels related to the view scale = 100% or the "auto" text string. The latter causes adjusting the widths to the contained data.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:e5";
	wsheet.SetColumnWidth("auto");
	wsheet.selectedRange = "f5";
	wsheet.SetColumnWidth("30");
	

GetRowHeight()

Returns the height of the current row (a row related to the top-left cell of the selection) in pixels. The height is calculated for the view scale = 100%. If the row height is automatic, the "auto" string is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var height = wsheet.GetRowHeigh();
	

SetRowHeight(height)

Sets the height for the rows included in the currently selected range. The height argument is a text string that can represent either a width in pixels related to the view scale = 100% or the "auto" text string. The latter turns on automatic heights (that is, heights adjusted to the contained data).

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:e5";
	wsheet.SetRowHeight("auto");
	wsheet.selectedRange = "f5";
	wsheet.SetRowHeight("30");
	

InsertColumns(type)

Inserts new columns based on the currently selected range. The argument is a numeric value that specifies the following:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:e5";
	wsheet.InsertColumns(1);
	wsheet.selectedRange = "f5";
	wsheet.InsertColumns(3);
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	// ...
	

DeleteColumns()

Deletes columns based on the currently selected range.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:e5";
	wsheet.DeleteColumns();
	wsheet.selectedRange = "f5";
	wsheet.DeleteColumns();
	

InsertRows(type)

Inserts new rows based on the currently selected range. The argument is a numeric value that specifies the following:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:b10";
	wsheet.InsertRows(1);
	wsheet.selectedRange = "b11";
	wsheet.InsertRows(3);
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	// ...
	

DeleteRows()

Deletes rows based on the currently selected range.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:b10";
	wsheet.DeleteRows(1);
	wsheet.selectedRange = "b11";
	wsheet.DeleteRows(3);
	

InsertSeries()

Insert a new data series based on the currently selected range. For the detailed description of this function, please see the "Entering data > Inserting series" help topic.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:b100";
	wsheet.InsertSeries();
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	// ...
	

IsText(cell)

Returns true is the specified cell contains a text/label.
If cell is a cell range, the method returns true if that range contains at least one text string and zero or more empty cells.
Otherwise the false value is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var check1 = wsheet.IsText("b5:b100");
	var check2 = wsheet.IsText("b101");
	

IsNumber(cell)

Returns true is the specified cell contains a numbers.
If cell is a cell range, the method returns true if that range contains at least one number and zero or more empty cells.
Otherwise the false value is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var check1 = wsheet.IsNumber("b5:b100");
	var check2 = wsheet.IsNumber("b101");
	

IsFormula(cell)

Returns true is the specified cell contains a formula.
If cell is a cell range, the method returns true if that range contains at least one formula and zero or more empty cells.
Otherwise the false value is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var check1 = wsheet.IsFormula("b5:b100");
	var check2 = wsheet.IsFormula("b101");
	

IsError(cell)

Returns the first found error code for the specified cell or range or 0 if the cell or range doesn't contain any cells/formulas returning errors. The possible error codes are as follows:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var check1 = wsheet.IsError("b5:b100");
	var check2 = wsheet.IsError("b101");
	

InsertData(cell, data, parse)

Inserts data into the specified cell or range. The data argument can be any text string containing up to 1024 characters. The parse argument is a logical value that specifies whether the submitted data should be parsed automatically and inserted as a number, date, a text string or a formula. If it's set to false, the entered data will be always treated as text - same as pressing Enter vs Enter+Shift when entering cell contents.
This function fully simulates manual data entering.

When entering large data sets, it's typically much more faster to use the Copy/Paste and InsertSeries methods and their variants.
Using InsertData() method will be also much faster if the updateMode property is set to manual and the application/workbook window is minimized as show in the 2nd example below.

Example 1.:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "11.5", true);
	wsheet.InsertData("b6", "1.7", true);
	wsheet.InsertData("b7:b10", "-0.1", true);
	wsheet.InsertData("b11", "=sum(b5:b10)", true);
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	// ...
	

Example 2.:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	GSCalc.MinimizeAppWindow();
	var updateMode = wbook.updateMode;
	wbook.updateMode = "manual";
	var i;
	for ( i = 1; i < 200000; ++i )
	{
		var ref = "b" + i;
		wsheet.InsertData(ref, "some text data", false);
	}
	wbook.updateMode = updateMode;
	GSCalc.RestoreAppWindow();
	

InsertComments(cell, comments)

Adds comments to specified cell. The comments argument can be any text string containing up to 1024 characters.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertComments("b5", "comments in b5");
	wsheet.InsertComments("b6", "comments in b6");
	

GetData(cell)

Returns data from the specified cell. The returned data can represent:

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "11.5", true);
	wsheet.InsertData("b6", "1.7", true);
	wsheet.InsertData("b7:b10", "-0.1", true);
	wsheet.InsertData("b11", "=sum(b5:b10)", true);
	var sum = wsheet.GetData("b5:b10"); // sum = 12.8
	

GetFormula(cell)

Returns formula from the specified cell that contains some formula.
If the specify cell doesn't contain a formula, an exception is thrown.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "11.5", true);
	wsheet.InsertData("b6", "1.7", true);
	wsheet.InsertData("b7:b10", "-0.1", true);
	wsheet.InsertData("b11", "=sum(b5:b10)", true);
	var formula = wsheet.GetFormula("b11"); // formula = "sum(b5:b10)"
	

GetComments(cell)

Returns comments for the specified cell. If the cell doesn't have comments, an empty string is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertComments("b5", "comments in b5");
	var comments = wsheet.GetComments("b5"); // comments = "comments in b5"
	

UpdateWindow()

UpdateWindow enforces GS-Calc to perform any pending screen updates of the workbook window before the script terminates and passes the control back to it.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.topLeftCell = "cv100";
	wsheet.UpdateWindow();
	GSCalc.Sleep(3000);
	wsheet.selectedRange = "ab10";
	wsheet.UpdateWindow();
	

SaveSelectionAsImage(file)

Saves the currently selected chart or image (if an object is selected) or the current cell range (if no object is selected) as an image to the specified file. The image format is determined by the file extension: *.png, *.jpg, *.gif, *.bmp, *.tiff.
If the file argument is an empty string, the standard Save File dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.selectedRange = "b5:b10";
	wsheet.SaveSelectionAsImage("d:\\image1.png");
	

CreatePrintSettings()

Creates and returns an object containing page/print settings. The PrintSettings object is then used to retrieve existing worksheets print settings and to set new ones.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	printSettings.printHeadings = false;
	wsheet.Print(false);
	

GetPrintSettings(printSettings)

Returns an object containing page/print settings. The PrintSettings object is then used to retrieve existing worksheet print settings and to set new ones.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	printSettings.printHeadings = false;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

SetPrintSettings(printSettings)

Sets the print settings for the active worksheet.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	printSettings.printHeadings = false;
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

Print(showPrintDialog)

Prints the active worksheet.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var wsheet = wbook.GetActiveWorksheet();
	var printSettings = wsheet.CreatePrintSettings();
	printSettings.printHeadings = false;
	printSettings.printedData = "range";
	printSettings.printedPages = "1,3,5-8";
	wsheet.SetPrintSettings(printSettings);
	wsheet.Print(false);
	

Workbook

GetActiveWorksheet()

Returns the active worksheet object. All methods called on this object always refers to the currently selected worksheet.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SelectTreeItem("sheet1");
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "data entered in sheet1!b5", true);
	wbook.SelectTreeItem("sheet2");
	wsheet.InsertData("b5", "data entered in sheet2!b5", true);
	

GetWorksheetCount()

Returns the number of worksheets in the workbook.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var counter = wbook.GetWorksheetCount();
	

GetFolderCount()

Returns the number of folders in the workbook.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var counter = wbook.GetFolderCount();
	

IsFolderEmpty(folder)

Returns true if the specified folder doesn't contain any tree items (worksheets or folders) and false otherwise.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var empty = wbook.IsFolderEmpty("folder1");
	

GetFirstTreeItem(folder)

Returns the first tree item (worksheets or folders) of the specified folder. If the folder argument is an empty string, the first item of the entire worksheet tree is returned. The returned value has a form of the full tree tree path.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var item1 = wbook.GetFirstTreeItem("");
	if ( wbook.IsFolder(item1) )
	{
		var item2 = wbook.GetFirstTreeItem(item1);
		// ...
	}
	

GetPrevTreeItem(treeItem)

Returns the previous sibling tree item (a worksheet or a folder) for the specified worksheet tree item.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var item1 = wbook.GetFirstTreeItem("");
	var item2 = wbook.GetNextTreeItem(item1);
	var item3 = wbook.GetPrevTreeItem(item2);
	// item1 == item3 if there are at least two sibling items in the main folder of the worksheet tree.
	var item1 = wbook.GetFirstTreeItem("folder1\\subfolder2");
	var item2 = wbook.GetNextTreeItem(item1);
	var item3 = wbook.GetPrevTreeItem(item2);
	// item1 == item3 if there are at least two sibling items in the "subfolder2" folder.
	

GetNextTreeItem(treeItem)

Returns the next sibling tree item (a worksheet or a folder) for the specified worksheet tree item.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var item1 = wbook.GetFirstTreeItem("");
	var item2 = wbook.GetNextTreeItem(item1);
	var item3 = wbook.GetPrevTreeItem(item2);
	// item1 == item3 if there are at least two sibling items in the main folder of the worksheet tree.
	var item1 = wbook.GetFirstTreeItem("folder1\\subfolder2");
	var item2 = wbook.GetNextTreeItem(item1);
	var item3 = wbook.GetPrevTreeItem(item2);
	// item1 == item3 if there are at least two sibling items in the "subfolder2" folder.
	

GetParentFolder(treeItem)

Returns the full path of the folder that contains the specified worksheet tree item (either a folder or a worksheet). If treeItem is top/root element, an empty string is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var item = wbook.GetFirstTreeItem("folder1\\subfolder2");
	var parent = wbook.GetParentFolder(item);
	// parent == "folder1\subfolder2"
	

IsWorksheet(treeItem)

Returns the logical true value id the specified worksheet tree item is a worksheet. Otherwise false is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var check1 = wbook.IsWorksheet("folder1\\sheet10");
	var check2 = wbook.IsWorksheet("abc");
	

IsFolder(treeItem)

Returns the logical true value id the specified worksheet tree item is a folder. Otherwise false is returned.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var check1 = wbook.IsFolder("folder1\\sheet10");
	var check2 = wbook.IsFolder("abc");
	

ExpandFolder(folder)

Expand the specified folder in the worksheet tree window.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.ExpandFolder("folder1");
	

CollapseFolder(folder)

Collapse the specified folder in the worksheet tree window.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.ColapseFolder("folder1");
	

SelectTreeItem(path)

Changes selection in the worksheet tree window. The new selected tree item is specified by the full path argument. If it points to a worksheet, the current active worksheet is changed automatically as well.
If path is an empty string, the top/root folder is selected.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SelectTreeItem("sheet1");
	var wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "data entered in sheet1!b5", true);
	wbook.SelectTreeItem("sheet2");
	wsheet.InsertData("b5", "data entered in sheet2!b5", true);
	

InsertFolder(name)

Inserts a new folder into the current worksheet tree folder. The name argument must not include tree path elements.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SelectTreeItem("folder2");
	wbook.InsertFolder("nested-folder3");
	

InsertWorksheet(name)

Inserts a new worksheet into the current worksheet tree folder. The name argument must not include tree path elements.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SelectTreeItem("");
	wbook.InsertFolder("sheet1");
	

DeleteTreeItem()

Deletes the currently selected worksheet tree item (which can be a single worksheet or a folder containing other folders and worksheets).

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SelectTreeItem("folder4");
	wbook.DeleteTreeItem();
	wbook.SelectTreeItem("folder5\\sheet1");
	wbook.DeleteTreeItem();
	

MoveTreeItem(sourcePath, targetPath)

Moves a worksheet tree item performing the equivalent of the drag-and-drop operation. If the targetPath specifies a worksheet, the moved item(s) are insert before it in the same folder.
If the targetPath specifies a folder, the moved item(s) are inserted as the last item(s) in that folder. An empty targetPath specifies the top/root folder.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.MoveTreeItem("folder1\\sheet11", "folder2");
	wbook.MoveTreeItem("folder1\\sheet10", "");
	

RenameTreeItem(name)

Changes the name of the currently selected worksheet tree item (except the top/root item).

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SelectTreeItem("folder4");
	wbook.RenameTreeItem("folder_4");
	wbook.SelectTreeItem("pivot tables\\customers")
	wbook.RenameTreeItem("new customers");
	

GetNamedRangeCount()

Returns the number of defined named ranges.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.GetNamedRangeCount();
	

GetNamedRange(index, propertyName)

Returns the name and cell range of the named expression specified by index. The type of the returned string is determined by the propertyName argumement and can be "name" or "range".

Example:

	var wbook = GSCalc.ThisWorkbook();
	var name = wbook.GetNamedRange(2, "name");
	var cell = wbook.GetNamedRange(2, "range");
	

SetNamedRange(index, rangeName, range)

Set the existing named range specified by index.

Example:

	var wbook = GSCalc.ThisWorkbook();
	if ( wbook.GetNamedRangeCount() >= 3 )
	{
		wbook.SetNamedRange(1, "start", "a10");
		wbook.SetNamedRange(2, "name", sheet1!c4);
		wbook.SetNamedRange(3, "sales", "\"d:\\[sample.gsc]Folder1\"!$A$1:$E$5");
	}
	

AddNamedRange(rangeName, range)

Adds a new named range specified by index.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.AddNamedRange("start", "a10");
	wbook.AddNamedRange("name", sheet1!c4);
	wbook.AddNamedRange("sales", "\"d:\\[sample.gsc]Folder1\"!$A$1:$E$5");
	

RemoveNamedRange(index)

Removes an existing named range specified by index.

Example:

	var wbook = GSCalc.ThisWorkbook();
	while ( wbook.GetNamedRangeCount() >= 1 )
	{
		wbook.RemoveNamedRange(1);
	}
	

RemoveAllNamedRanges()

Removes all defined named ranges.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.RemoveAllNamedRanges();
	

Save()

Saves the workbook using the current file format and file path. If this is a new workbook, the Save As dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.Save();
	

SaveAs(path)

Saves the current workbook to a new file. If path is an empty string, Save As dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SaveAs("d:\\wbook1.gsc");
	

SaveAsPDFFile(path, saveAllWorksheets)

Saves the current workbook to the specified PDF file. If the logical saveAllWorksheets value is true, all worksheets are saved and the tree structure is preserved in that PDF file.
If saveAllWorksheets is false, only the current/active worksheet is saved.
When saving to PDFs the current worksheets print/page settings determine the layout of PDF pages.
The method doesn't change the file path information or the modification state of the original workbook.
If path is an empty string, the Save As dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SaveAsPDFFile("d:\\copy_of_wbook1.pdf");
	

SaveAsExcelFile(path)

Saves the current workbook as a new Excel XML file.
If path is an empty string, the Save As dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SaveAsExcelFile("d:\\wbook1.xml");
	

SaveAsTextFile(path, showDialogBox, textParams)

Saves the current workbook as a new text file using the provided TextParams object. If showDialogBox is true, the Save Text File dialog box is displayed.
If path is an empty string, the Save As dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var textParams = GSCalc.CreateTextParams();
	textParams.separator = "\t"; // tab-separeted values
	textParams.quotingSymbol = "\"";
	textParams.encoding = "utf8";
	wbook.SaveAsTextFile("d:\\wbook1.txt", false, textParams);
	wbook.SaveAsTextFile("d:\\wbook2.txt", true, textParams);
	

SaveAsXBaseFile(path, showDialogBox, xBaseParams)

Saves the current workbook as a new xBase file using the provided XBaseParams object. If showDialogBox is true, the Save xBase File dialog box is displayed and it contains a suggested set of fields based on the data the worksheet contains.
If path is an empty string, the Save As dialog box is displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.format = "dbaseIV";
	xBaseParams.AddField("item", "C", 40, 0);
	xBaseParams.AddField("price", "N", 5, 2);
	xBaseParams.encoding = "windows";
	wbook.SaveAsXBaseFile("d:\\wbook1.dbf", false, xBaseParams);
	wbook.SaveAsXBaseFile("d:\\wbook2.dbf", true, xBaseParams);
	

Reload()

Reloads the workbook. All changes are discarded.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.Reload();
	

Close()

Closes the workbook. If the modified property is true, users are prompted to save it. Trying use a workbook object after it's closed results in throwing the E_POINTER exception.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.Close();
	try
	{
		var counter = wbook.GetWorksheetCount();
	}
	catch(e)
	{
		GSCalc.MessageBox(e, "ok", 1, "error");
	}
	

GetFileInfo(path, type, value)

// 1 - size, 2 - mod. dateReleaseFile

modified.

Example:

	// file size in bytes
	var size = GSCalc.GetFileInfo("c:\\file01.gsc", 1);
	// last modification date in the format YYYY-MM-DD (YYYY-MM-DDTHH:MM:SS)
	var modificationData = GSCalc.GetFileInfo("c:\\file01.gsc", 2);
	

ReleaseFile()

Detaches and closes the currently open workbook file. The workbook and its window remain open and you keep on editing it allowing other programs to access that file at the same time.
If you try to save it without calling the AttachFile() function first, the Save As dialog box will be displayed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var path = wbook.ReleaseFile();
	

AttachFile(path)

Attaches previously detached file and open it. Returns 1 if a given file was modified after ReleaseFile(), 0 if not and -1 if the file can't be opened and attached

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.AttachFile("c:\\text_file01.csv");
	

MergeRows(mergeParams)

Merges/adds rows from other GS-Calc *.gsc files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method.
For all parameters see the MergeParams description.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var merge = GSCalc.CreateMergeParams();
	// merge records from all *.gsc files with names starting with "gsc_file"
	merge.path = "c:\\gsc_file*.gsc";
	merge.table = "";
	wbook.MergeRows(mergeParams)
	

MergeRowsFromODSFile(mergeParams)

Merges/adds rows from other *.ods files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method.
For all parameters see the MergeParams description.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var merge = GSCalc.CreateMergeParams();
	// merge records from all *.ods files with names starting with "ods_file"
	merge.path = "c:\\ods_file*.ods";
	merge.table = "";
	wbook.MergeRowsFromODSFile(mergeParams)
	

MergeRowsFromTextFile(mergeParams, textParams)

Merges/adds rows from other *.txt files to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method and textParams - with the CreateTextParams() method.
For all parameters see the MergeParams and TextParams descriptions.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var textParams = GSCalc.CreateTextParams();
	textParams.separator = ",";
	var mergeParams = GSCalc.CreateMergeParams();
	// merge records from all *.csv files with names starting with "csv_file"
	merge.path = "c:\\csv_file*.csv";
	merge.table = "";
	wbook.MergeRowsFromTextFile(mergeParams, textParams)
	

MergeRowsFromExcelFile(mergeParams)

Merges/adds rows from other *.xlsx files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method.
For all parameters see the MergeParams description.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var merge = GSCalc.CreateMergeParams();
	// merge records from all *.xlsx files with names starting with "xlsx_file"
	merge.path = "c:\\xlsx_file*.xlsx";
	merge.table = "";
	wbook.MergeRowsFromExcelFile(mergeParams)
	

MergeRowsFromXBaseFile(mergeParams, xBaseParams)

Merges/adds rows from other dBaseIV *.dbf files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method and xBaseParams - CreateXBaseParams.
For all parameters see the MergeParams description.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var merge = GSCalc.CreateMergeParams();
	// merge records from all *.dbf files with names starting with "dbf_file"
	merge.path = "c:\\dbf_file*.dbf";
	merge.table = "";
	var xbaseParams = GSCalc.CreateXBaseParams();
	xbaseParams.encoding = "windows";
	wbook.MergeRowsFromXBaseFile(mergeParams)
	

MergeTable(path, table)

Merges/adds tables from other GS-Calc *.gsc files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	var wbook = GSCalc.ThisWorkbook();
	// merge tables from all *.gsc files with names starting with "gsc_file"
	wbook.MergeTable("c:\\gsc_file*.gsc", "customers");
	

MergeTableFromODSFile(path, table)

Merges/adds tables from other *.ods files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	var wbook = GSCalc.ThisWorkbook();
	// merge tables from all *.ods files with names starting with "ods_file"
	wbook.MergeTable("c:\\ods_file*.ods", "customers");
	

MergeTableFromTextFile(path, table, textParams)

Merges/adds tables from other text files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.separator = ",";
	var wbook = GSCalc.ThisWorkbook();
	// merge tables from all *.csv files with names starting with "csv_file"
	wbook.MergeTable("c:\\csv_file*.csv", "", textParams);
	

MergeTableFromExcelFile(path, table)

Merges/adds tables from other *.xlsx files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	var wbook = GSCalc.ThisWorkbook();
	// merge default tables from all *.xlsx files with names starting with "xlsx_file"
	wbook.MergeTable("c:\\xlsx_file*.xlsx", "");
	

MergeTableFromXBaseFile(path, table, xBaseParams)

Merges/adds tables from other dBaseIV *.dbf files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.encoding = "windows";
	var wbook = GSCalc.ThisWorkbook();
	// merge tables from all *.dbf files with names starting with "dbf_file"
	wbook.MergeTable("c:\\dbf_file*.dbf", "");
	

SetFilePassword(enable, method, oldPassword, newPassword)

Sets, modifies or removes password protection for the workbook.
If the logical enable argument is true, the password protection is added, if it's false, the protection is removed.
The method argument can currently be only the "blowfish" encryption method name.
If the workbook is already password protected, the oldPassword argument must contain the existing password.
If enable is true, the newPassword argument argument must contain a new password consisting of at least 6 characters.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SetFilePassword(true, "blowfish", "Df8ER1", "97uYwp");
	var wbook = GSCalc.NewWorkbook();
	wbook.SetPassword(true, "blowfish", "", "97uYwp");
	

SetCellPassword(enable, oldPassword, newPassword)

Sets, modifies or removes password protection for idividual cells.
Once this password is set, the Format > Protect command can be used to set the cell protection.

If the logical enable argument is true, the password protection is added, if it's false, the protection is removed.
If enable is true, the newPassword argument argument must contain a new password consisting of at least 6 characters.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SetCellPassword(true, "Df8ER1", "97uYwp");
	

SetTreePassword(enable, oldPassword, newPassword)

Sets, modifies or removes password protection for the worksheet tree structure and view splitters.
If the logical enable argument is true, the password protection is added, if it's false, the protection is removed.
If enable is true, the newPassword argument argument must contain a new password consisting of at least 6 characters.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.SetTreePassword(true, "Df8ER1", "97uYwp");
	

UpdateAllWorksheets()

Updates all formulas in all worksheets in this workbook. (Same as the Update All - F9 command.)

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.UpdateAllWorksheets();
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	

UpdateActiveWorksheet()

Updates all formulas in the active worksheet. (Same as the Update Worksheet Shift+F9 command.)

GS-Calc enables you to load/save quickly extremely large files and use multicore calculations for any formulas using dynamic references because it doesn't pre-build calculation trees. However, the disadvantage of this is that if you use the UpdateAllWorksheets() method, GS-Calc will be unconditionally updating all formulas in all worksheets, no matter whether the current data change requires it.
Setting the updateMode to manual and using sequences of the UpdateActiveWorksheet() and/or UpdateAllWorksheetRegion() methods relevant to your worksheets design, you can greatly increase the update speed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.UpdateActiveWorksheet();
	wbook.WaitForUpdate(); // to allow the background updating to complete before further actions
	

UpdateActiveWorksheetRegion(range)

Updates all formulas in the specified range in the active worksheet.

GS-Calc enables you to load/save quickly extremely large files and use multicore calculations for any formulas using dynamic references because it doesn't pre-build calculation trees. However, the disadvantage of this is that if you use the UpdateAllWorksheets() method, GS-Calc will be unconditionally updating all formulas in all worksheets, no matter whether the current data change requires it.
Setting the updateMode to manual and using sequences of the UpdateActiveWorksheet() and/or UpdateAllWorksheetRegion() methods relevant to your worksheets design, you can greatly increase the update speed.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.UpdateActiveWorksheetRegion("a5:b1000000");
	wbook.WaitForUpdate();  // to allow the background updating to complete before further actions
	wbook.UpdateActiveWorksheetRegion("g5:m1000000");
	wbook.WaitForUpdate();  // to allow the background updating to complete before further actions
	

WaitForUpdate()

If the background updating mode in turned on and there is an updating process running, the method waits till that process completes.
If the background updating mode is turned off, the method returns immediately.
Performing any editing action before the update completes restarts the updating process.
Some actions (like saving) can't be carried out before the pending update completes.

For efficiency reasons it's recommended that you set the updateMode property to "manual" before performing a massive data editing/entering actions.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.UpdateAllWorksheets();
	wbook.WaitForUpdate();
	

MaximizeWindow()

Maximizes the workbook window.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.MaximizeWindow();
	

RestoreWindow()

Restores the previous size of the workbook window after it's maximized.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.RestoreWindow();
	

modified

A logical value specifying whether the contents of the workbook was modified. It's managed automatically by the program. Typically, modifying it explicitly might be necessary only to avoid notifications about closing an unsaved workbook.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.modified = false;
	wbook.Close()
	

updateMode

Specifies whether formulas are updated automatically or manually. The method accepts the following strings as its argument:

For more details, please see the Settings help topic.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.updateMode = "manual";
	

updateThreads

Specifies the number of threads/CPUs used when updating workbook formulas:

For more details, please see the Settings help topic.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.updateThreads = 4;
	// ...
	wbook.updateThreads = "default";
	

updatePriority

Specifies the update threads priority:

For more details, please see the Settings help topic.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.updatePriority = "high";
	// ...
	wbook.updatePriority = "default";
	

updateOptimization

Specifies the update optimization. This can be either the default string or any combination of numeric values listed below.

For more details, please see the Settings help topic.

Example:

	var wbook = GSCalc.ThisWorkbook();
	wbook.updateOptimization = 3;
	// ...
	wbook.updateOptimization = "default";
	

Application

CreateXBaseParams()

Creates and returns an object containing xBase (dBase, Clipper, FoxPro) file format details. The XBaseParams object is then used to retrieve header/fields information of an existing opened database file or to create header/fields structure for a new database file.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.format = "dbaseIV";
	xBaseParams.AddField("item", "C", 40, 0);
	xBaseParams.AddField("price", "N", 5, 2);
	xBaseParams.encoding = "windows";
	wbook.SaveAsXBaseFile("d:\\wbook1.dbf", false, xBaseParams);
	wbook.SaveAsXBaseFile("d:\\wbook2.dbf", true, xBaseParams);
	

CreateTextParams()

Creates and returns an object containing text file format details. The TextParams object is then used to open existing text files and to create new ones.

Example:

	var wbook = GSCalc.ThisWorkbook();
	var textParams = GSCalc.CreateTextParams();
	textParams.separator = "\t"; // tab-separeted values
	textParams.quotingSymbol = "\"";
	textParams.encoding = "utf8";
	wbook.SaveAsTextFile("d:\\wbook1.txt", false, textParams);
	wbook.SaveAsTextFile("d:\\wbook2.txt", true, textParams);
	

CreateMergeParams

A set of parameters used by rows-merging functions.

ThisWorkbook()

Returns the Workbook object corresponding to the workbook that contains the executed script or (if the script is not a part of the workbook contents) to the current workbook.

Example:

	var wbook1 = GSCalc.ThisWorkbook();
	var wbook2 = GSCalc.NewWorkbook();
	var wbook3 = GSCalc.OpenWorkbook("d:\\sales2013\\june.gsc", "");
	

NewWorkbook()

Creates a new workbook and returns the corresponding Workbook object.

Example:

	var wbook1 = GSCalc.ThisWorkbook();
	var wbook2 = GSCalc.NewWorkbook();
	var wbook3 = GSCalc.OpenWorkbook("d:\\sales2013\\june.gsc", "");
	

OpenWorkbook(path, password)

Opens an existing workbook in the *.gsc or *.odf file format and returns the corresponding Workbook object.
If path is an empty string, the Open File dialog box is displayed.

Example:

	var wbook1 = GSCalc.ThisWorkbook();
	var wbook2 = GSCalc.NewWorkbook();
	var wbook3 = GSCalc.OpenWorkbook("d:\\sales2013\\june.gsc", "");
	var wbook4 = GSCalc.OpenWorkbook("d:\\sales2013\\june.ods", "FE2OkP");
	

OpenTextFile(path, showDialogBox, textParams)

Opens an existing text file and returns the corresponding Workbook object. If showDialogBox is true, the Open Text File dialog box is displayed.
If path is an empty string, the Open File dialog box is displayed.

Example:

	var textParams = GSCalc.CreateTextParams();
	textParams.separator = "\t"; // tab-separeted values
	textParams.quotingSymbol = "\"";
	textParams.encoding = "utf8";
	var wbook1 = GSCalc.OpenTextFile("d:\\wbook1.txt", false, textParams);
	var wbook2 = GSCalc.OpenTextFile("d:\\wbook2.txt", true, textParams);
	

OpenExcelFile(path)

Opens an existing workbook in the Excel XML *.xml file format and returns the corresponding Workbook object.
If path is an empty string, the Open File dialog box is displayed.

Example:

	var wbook = GSCalc.OpenExcelFile("d:\\sales2013\\june.xml");
	

OpenXBaseFile(path, showDialogBox, xBaseParams)

Opens an existing xBase file and returns the corresponding Workbook object. If showDialogBox is true, the Open xBase File dialog box is displayed.
If path is an empty string, the Open File dialog box is displayed.

Example:

	var xBaseParams = GSCalc.CreateXBaseParams();
	xBaseParams.format = "dbaseIV";
	var wbook1 = GSCalc.OpenXBaseFile("d:\\wbook1.dbf", false, xBaseParams);
	xBaseParams.format = "clipper";
	var wbook2 = GSCalc.OpenXBaseFile("d:\\wbook2.dbf", true, xBaseParams);
	

GetBookmarkCount()

Returns the number of bookmarks defined for the current application profile.

Example:

	var counter = GSCalc.GetBookmarkCount();
	

GetBookmark(index)

Returns the string representing the bookmark defined at the index position in the current application profile.

Example:

	var counter = GSCalc.GetBookmarkCount();
	var i;
	for ( i = 1; i <= counter; ++i )
	{
		var bookmark = GSCalc.GetBookmark(i);
		GSCalc.MessageBox(bookmark, "ok", 1, "information");
	}
	

SetBookmark(index, bookMark)

Modifies an existing bookmark defined at the index position in the current application profile.

Example:

	if ( GSCalc.GetBookmarkCount() > 0 )
	{
		GSCalc.SetBookmark(1, "AH1");
	}
	

AddBookmark(bookMark)

Adds a new bookmark for the current application profile.

Example:

	GSCalc.RemoveAllBookmarks();
	GSCalc.AddBookmark("AH1");
	

RemoveBookmark(index)

Adds a new bookmark for the current application profile.

Example:

	while ( GSCalc.GetBookmarkCount() > 0 )
	{
		GSCalc.RemoveBookmark(1);
	}
	

RemoveAllBookmarks()

Adds a new bookmark for the current application profile.

Example:

	GSCalc.RemoveAllBookmarks();
	

LoadProfile(path)

Loads profile information from the specified XML file. If path is an empty string, the Open File dialog box is displayed.

Example:

	GSCalc.LoadProfile("d:\\profiles\\prof1.xml");
	

SaveProfile(path)

Save profile information to the specified XML file. If path is an empty string, the Save dialog box is displayed.

Example:

	GSCalc.SaveProfile("d:\\profiles\\prof1.xml");
	

GetWorkbookCount()

Returns the number of open workbooks.

Example:

	var counter = GSCalc.GetWorkbookCount();
	

CloseAllWorkbooks()

Closes all open workbooks. Trying use a workbook object after it's closed results in throwing the E_POINTER exception.

Example:

	var wbook = GSCalc.ThisWorkbook();
	GSCalc.CloseAllWorkbooks();
	try
	{
		var counter = wbook.GetWorksheetCount();
	}
	catch(e)
	{
		GSCalc.MessageBox(e, "ok", 1, "error");
	}
	

TileWorkbooks(tileVertically)

Tiles open workbook windows vertically or horizontally.

Example:

	GSCalc.TileWorkbooks(true);
	GSCalc.TileWorkbooks(false);
	

MaximizeAppWindow()

Maximizes the application window.

Example:

	GSCalc.MaximizeAppWindow();
	

MinimizeAppWindow()

Minimizes the application window.

Example:

	GSCalc.MinimizeAppWindow();
	

RestoreAppWindow()

Restores the previous size and position of the application window after it's minimized or maximized.

Example:

	GSCalc.RestoreAppWindow();
	
{ "GetFolder(title, folder)", 1 },

GetFilePath(saveAs, title, folder, name, ext)

Displays the "File" dialog box and returns selected file path.

The dialog box returns the full file path. If the file selction is cancelled, an empty string is returned.

Example:

	var openFilePath = GSCalc.GetFilePath(false, "Open XLSX File", "d:\\", "d:\\newfile.xlsx", ".xlsx");
	

GetFolder(title, folder)

Displays the "Folder" dialog box and returns selected folder path.

The dialog box returns the full folder path. If the folder selection is cancelled, an empty string is returned.

Example:

	var folderPath = GSCalc.GetFolder("Select Folder", "d:\\");
	

MessageBox(message, buttons, button, icon)

Displays a message box using the following arguments:

The method returns a text string representing the name of the clicked/pressed button:

Example:

	var wbook;
	if ( GSCalc.MessageBox("Open this file: calc1.gsc", "yes-no", 1, "question") == "yes" )
	{
		wbook = GSCalc.OpenWorkbook("d:\\sales2013\\calc1.gsc", "");
	}
	

InputBox(title, password, initValue)

Displays a simple, one-line input box using the following arguments:

The method returns the entered text. If a use click the Cancel button, the E_FAIL exception is thrown.

Example:

	var name = GSCalc.InputBox("Enter your name", false, "");
	

Sleep(time)

Suspend the execution of the script for the specified time in milliseconds.

Example:

	GSCalc.Sleep(5000);
	

statusBar

Specifies the text displayed in the 1st pane of status bar.

Example:

	GSCalc.statusBar = "Executing script...";
	

startFolder

Specifies the default workbook folder.

Example:

	GSCalc.startFolder = "d:\\users\\kt";
	

Related Topics

Samples