[]
        
(Showing Draft Content)

GC.Spread.Sheets.CellRange

Class: CellRange

Spread.Sheets.CellRange

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new CellRange(sheet, row, col, rowCount?, colCount?, sheetArea?)

Represents a cell range in a sheet.

Parameters

Name Type Description
sheet Worksheet The sheet that contains this cell range.
row number The row index of the cell.
col number The column index of the cell.
rowCount? number -
colCount? number -
sheetArea? SheetArea -

Properties

col

col: number

Gets the starting column index.


colCount

colCount: number

Gets the column count.


row

row: number

Gets the starting row index.


rowCount

rowCount: number

Gets the row count.


sheet

sheet: Worksheet

Gets the sheet that contains this cell range.


sheetArea

sheetArea: SheetArea

Gets the area that contains this cell range.

Methods

altText

altText(value?): any

Gets or sets the alternative text of the cell for screen readers.

example

var SpreadIcon = {
    FolderOpen: '\ue685',
    InfoFilled: '\ue718',
    Library: '\ue69d',
    NotebookFilled: '\uD800\uDC0F',
    Browse: '\ue626'
};
activeSheet.getCell(1, 1).value(SpreadIcon.FolderOpen).altText("Folder Open Icon");

// Besides plain text, the alternative text could also contain placeholder {value} or {formatted}, which represents cell value or cell formatted value.
// For example, if the cell value is 1000, and the alt text is "Sales amount is {value}", the final accessible content should be "Sales amount is 1000".
activeSheet.getCell(1, 1).value(1000).altText("Sales amount is {value}");

Parameters

Name Type Description
value? any The alternative text of the cell.

Returns

any

If no value is set, returns the alternative text of the cell; otherwise, returns the cell.


backColor

backColor(value?): any

Gets or sets the background color for the cell, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).backColor("pink");

Parameters

Name Type
value? string | IGradientFill | IGradientPathFill | IPatternFill

Returns

any

If no value is set, returns the cell background color; otherwise, returns the cell.


backgroundImage

backgroundImage(value?): any

Gets or sets the background image for the cell.

example

activeSheet.getCell(1,1).backgroundImage("images/example.jpg");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell background image; otherwise, returns the cell.


backgroundImageLayout

backgroundImageLayout(value?): any

Gets or sets the background image layout for the cell.

example

var layout = GC.Spread.Sheets.ImageLayout.stretch;
activeSheet.getRange(-1, 1, -1, 1, GC.Spread.Sheets.SheetArea.viewport).backgroundImageLayout(layout);

Parameters

Name Type
value? ImageLayout

Returns

any

If no value is set, returns the cell background image layout; otherwise, returns the cell.


bindingPath

bindingPath(path?): any

Gets or sets the binding path for cell binding.

example

//This example uses the bindingPath method.
var test = {name: "John"};
activeSheet.getCell(0,0).bindingPath( "name");
activeSheet.setDataSource(new GC.Spread.Sheets.Bindings.CellBindingSource(test));

Parameters

Name Type Description
path? string The binding path for cell binding.

Returns

any

If no value is set, returns the binding path for cell binding; otherwise, returns the worksheet.


borderBottom

borderBottom(value?): any

Gets or sets the bottom border of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderBottom(new GC.Spread.Sheets.LineBorder("blue", GC.Spread.Sheets.LineStyle.mediumDashed));

Parameters

Name Type
value? LineBorder

Returns

any

If no value is set, returns the cell bottom border line; otherwise, returns the cell.


borderLeft

borderLeft(value?): any

Gets or sets the left border of the cell.

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderLeft(new GC.Spread.Sheets.LineBorder("green", GC.Spread.Sheets.LineStyle.mediumDashed));

example

activeSheet.getCell(1,1).borderLeft(new GC.Spread.Sheets.LineBorder("red", GC.Spread.Sheets.LineStyle.double));

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderLeft(new GC.Spread.Sheets.LineBorder("blue", GC.Spread.Sheets.LineStyle.mediumDashed));

Parameters

Name Type
value? LineBorder

Returns

any

If no value is set, returns the cell left border line; otherwise, returns the cell.


borderRight

borderRight(value?): any

Gets or sets the right border of the cell.

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderRight(new GC.Spread.Sheets.LineBorder("green", GC.Spread.Sheets.LineStyle.mediumDashed));

example

activeSheet.getCell(1,1).borderRight(new GC.Spread.Sheets.LineBorder("red", GC.Spread.Sheets.LineStyle.double));

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderRight(new GC.Spread.Sheets.LineBorder("blue", GC.Spread.Sheets.LineStyle.mediumDashed));

Parameters

Name Type
value? LineBorder

Returns

any

If no value is set, returns the cell right border line; otherwise, returns the cell.


borderTop

borderTop(value?): any

Gets or sets the top border of the cell.

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderTop(new GC.Spread.Sheets.LineBorder("green", GC.Spread.Sheets.LineStyle.mediumDashed));

example

activeSheet.getCell(1,1).borderTop(new GC.Spread.Sheets.LineBorder("red", GC.Spread.Sheets.LineStyle.double));

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderTop(new GC.Spread.Sheets.LineBorder("blue", GC.Spread.Sheets.LineStyle.mediumDashed));

Parameters

Name Type
value? LineBorder

Returns

any

If no value is set, returns the cell top border line; otherwise, returns the cell.


cellButtons

cellButtons(value?): any

Gets or sets the cellButtons of the cell.

example

activeSheet.getRange(2,-1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).cellButtons([caption:"Text"]]);

example

var cellButtons = activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).cellButtons();

Parameters

Name Type Description
value? ICellButton[] the cellButtons of the cell.

Returns

any

If no value is set, returns the cellButtons of the cell; otherwise, returns the cell.


cellPadding

cellPadding(value?): any

Gets or sets the cell padding.

example

// This example adds cell padding around the watermark.
var type = new GC.Spread.Sheets.Style();
type.watermark = "User name";
type.cellPadding = "20";
type.labelOptions = {alignment:GC.Spread.Sheets.LabelAlignment.topLeft, visibility: GC.Spread.Sheets.LabelVisibility.visible};
activeSheet.setStyle(0, 1, type);
activeSheet.getRange(0, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(60);
activeSheet.getRange(-1, 1, -1, 1).width(150);
var combo = new GC.Spread.Sheets.CellTypes.ComboBox();
combo.items([{ text: "Oranges", value: "11k" }, { text: "Apples", value: "15k" }, { text: "Grape", value: "100k" }]);
combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
activeSheet.setCellType(2, 1, combo, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport).watermark("ComboBox Cell Type").cellPadding('10 10 20 10');
activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport).labelOptions({alignment: GC.Spread.Sheets.LabelAlignment.bottomCenter, foreColor: 'yellowgreen', font: 'bold 15px Arial'});
activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(60);

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the value of the cell padding; otherwise, returns the cell.


cellType

cellType(value?): any

Gets or sets the cell type of the cell.

example

activeSheet.getRange(-1, 1, -1, 1, GC.Spread.Sheets.SheetArea.viewport).cellType(new GC.Spread.Sheets.CellTypes.CheckBox());

Parameters

Name Type
value? Base

Returns

any

If no value is set, returns the cell type; otherwise, returns the cell.


clear

clear(type): void

Clears the specified area.

Parameters

Name Type Description
type StorageType The clear type.

Returns

void


comment

comment(value?): any

Gets or sets the comment for the cell.

example

// This example creates a cell comment.
var comment = new GC.Spread.Sheets.Comments.Comment();
comment.text("new comment!");
comment.backColor("yellow");
comment.foreColor("green");
comment.displayMode(GC.Spread.Sheets.Comments.DisplayMode.alwaysShown);
activeSheet.getCell(5,5).comment(comment);

Parameters

Name Type Description
value? Comment The comment to set in the cell.

Returns

any

If no value is set, returns the comment in the cell; otherwise, returns the cell range.


defaultValue

defaultValue(value?): any

Gets or sets the default value of the cell.

example

activeSheet.getCell(1,1).defaultValue(10);
activeSheet.getCell(1,3).defaultValue("=LastYear+1000");

Parameters

Name Type
value? any

Returns

any

If no value is set, returns the cell default value; otherwise, returns the cell.


diagonalDown

diagonalDown(value?): any

Gets or sets the diagonalDown of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).diagonalDown(new GC.Spread.Sheets.LineBorder("blue", GC.Spread.Sheets.LineStyle.mediumDashed));

Parameters

Name Type
value? LineBorder

Returns

any

If no value is set, returns the cell diagonalDown line; otherwise, returns the cell.


diagonalUp

diagonalUp(value?): any

Gets or sets the diagonalUp of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).diagonalUp(new GC.Spread.Sheets.LineBorder("blue", GC.Spread.Sheets.LineStyle.mediumDashed));

Parameters

Name Type
value? LineBorder

Returns

any

If no value is set, returns the cell diagonalUp line; otherwise, returns the cell.


dropDowns(value?): any

Gets or sets the dropDowns of the cell.

example

activeSheet.getRange(2,-1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).dropDowns([caption:"Text"]]);

example

var dropDowns = activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).dropDowns();

Parameters

Name Type
value? IDropdown[]

Returns

any

If no value is set, returns the dropDowns of the cell; otherwise, returns the cell.


font

font(value?): any

Gets or sets the font for the cell, such as "normal normal normal 20px/normal Arial".

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).font("12pt Arial");

example

activeSheet.getCell(1,1).font("8pt Arial");

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).font("12pt Arial");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell's font; otherwise, returns the cell.


fontFamily

fontFamily(value?): any

Gets or sets the fontFamily for the cell, such as "Arial".

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).fontFamily("Arial");

example

activeSheet.getCell(1,1).fontFamily("Arial");

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).fontFamily("Arial");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell's fontFamily; otherwise, returns the cell.


fontSize

fontSize(value?): any

Gets or sets the fontSize for the cell, such as "16px".

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).fontSize("16px");

example

activeSheet.getCell(1,1).fontSize("16px");

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).fontSize("16px");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell's fontSize; otherwise, returns the cell.


fontStyle

fontStyle(value?): any

Gets or sets the fontStyle for the cell, such as "italic".

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).fontStyle("italic");

example

activeSheet.getCell(1,1).fontStyle("italic");

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).fontStyle("italic");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell's fontStyle; otherwise, returns the cell.


fontWeight

fontWeight(value?): any

Gets or sets the fontWeight for the cell, such as "bold".

example

activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).fontWeight("bold");

example

activeSheet.getCell(1,1).fontWeight("bold");

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).fontWeight("bold");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell's fontWeight; otherwise, returns the cell.


foreColor

foreColor(value?): any

Gets or sets the color of the text in the cell, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).foreColor("blue");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell foreground color; otherwise, returns the cell.


formatter

formatter(value?): any

Gets or sets the formatter for the cell.

example

activeSheet.getCell(1,1).formatter("0.000%");

example

activeSheet.getCell(1, -1).formatter("0.000%");
activeSheet.getCell(1,0).value("2");

example

activeSheet.getCell(-1, 0).formatter("0.000%");
activeSheet.getCell(0,0).value("2");

Parameters

Name Type
value? string | GeneralFormatter

Returns

any

If no value is set, returns the cell formatter string or object; otherwise, returns the cell.


formula

formula(value?): any

Gets or sets the formula for the cell.

example

activeSheet.getCell(0,2).formula("DATEDIF(DATE(2003,1,1),DATE(2016,1,1),\"Y\")");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell formula; otherwise, returns the cell.


hAlign

hAlign(value?): any

Gets or sets the horizontal alignment of the contents of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).hAlign(GC.Spread.Sheets.HorizontalAlign.right);

Parameters

Name Type
value? HorizontalAlign

Returns

any

If no value is set, returns the horizontal alignment of the contents of the cell; otherwise, returns the cell.


height

height(value?): any

Gets or sets the height of the row in pixels.

example

activeSheet.getRange(0, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(90);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the row height; otherwise, returns the row.


imeMode

imeMode(value?): any

Gets or sets the imeMode of the cell.

example

activeSheet.getCell(0, 0).imeMode(GC.Spread.Sheets.ImeMode.disabled);
//or
var style = new GC.Spread.Sheets.Style();
style.imeMode = GC.Spread.Sheets.ImeMode.disabled;
activeSheet.setStyle(0, 0, style);

example

activeSheet.getRange(2, -1, 1, -1).imeMode(GC.Spread.Sheets.ImeMode.active);

example

activeSheet.getRange(-1, 2, -1, 1).imeMode(GC.Spread.Sheets.ImeMode.auto);

Parameters

Name Type
value? ImeMode

Returns

any

If no value is set, returns the cell imeMode; otherwise, returns the cell.


isVerticalText

isVerticalText(value?): any

Gets or sets whether the cell's text is vertical.

example

activeSheet.getRange(2,-1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).isVerticalText(false);
activeSheet.setText(2,0,"This is a test");

example

activeSheet.getCell(1,1).isVerticalText(true);

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).isVerticalText(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the cell's text vertical; otherwise, returns the cell.


labelOptions

labelOptions(value?): any

Gets or sets the cell label options.

example

//This example sets label options for the watermark.
var type = new GC.Spread.Sheets.Style();
type.watermark = "User name";
type.cellPadding = "20";
type.labelOptions = {alignment:GC.Spread.Sheets.LabelAlignment.topLeft, visibility: GC.Spread.Sheets.LabelVisibility.visible};
activeSheet.setStyle(0, 1, type);
activeSheet.getRange(0, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(60);
activeSheet.getRange(-1, 1, -1, 1).width(150);
var combo = new GC.Spread.Sheets.CellTypes.ComboBox();
combo.items([{ text: "Oranges", value: "11k" }, { text: "Apples", value: "15k" }, { text: "Grape", value: "100k" }]);
combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
activeSheet.setCellType(2, 1, combo, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport).watermark("ComboBox Cell Type").cellPadding('10 10 20 10');
activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport).labelOptions({alignment: GC.Spread.Sheets.LabelAlignment.bottomCenter, foreColor: 'yellowgreen', font: 'bold 15px Arial'});
activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(60);

Parameters

Name Type
value? ILabelOptions

Returns

any

If no value is set, returns the value of the cell label options; otherwise, returns the cell.


locked

locked(value?): any

Gets or sets whether the cell is locked. When the sheet is protected, the locked cell cannot be edited.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the cell is locked; otherwise, returns the cell.


mask

mask(value?): any

Gets or sets the cell mask.

example

//This example sets mask of the cell.
var style = new GC.Spread.Sheets.Style();
var pattern = "[a0_]{8}";
style.pattern = pattern;
activeSheet.setStyle(0, 1, style);
activeSheet.getCell(0, 1, GC.Spread.Sheets.SheetArea.viewport).mask({ pattern: pattern});

Parameters

Name Type
value? IMaskType

Returns

any

If no value is set, returns the value of the cell mask; otherwise, returns the cell.


quotePrefix

quotePrefix(value?): any

Gets or sets the quote prefix of the cell.

example

activeSheet.getCell(1,1).quotePrefix(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns the content of the quotePrefix; otherwise, returns the cell.


resizable

resizable(value?): any

Gets or sets whether the row or column can be resized by the user.

example

activeSheet.getRange(-1, 3, -1, 1. GC.Spread.Sheets.SheetArea.viewport).resizable(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the user can resize the row; otherwise, returns the row or column.


setBorder

setBorder(border, option): void

Sets the border for the specified area.

example

//This example creates borders.
sheet.getCell(1, 1).borderTop(new GC.Spread.Sheets.LineBorder("#F0F8FF",GC.Spread.Sheets.LineStyle.double));
sheet.getCell(1, 1).borderLeft(new GC.Spread.Sheets.LineBorder("#F0F8FF",GC.Spread.Sheets.LineStyle.hair));
sheet.getCell(1, 1).borderRight(new GC.Spread.Sheets.LineBorder("#FAEBD7",GC.Spread.Sheets.LineStyle.dashDot));
sheet.getCell(1, 1).borderBottom(new GC.Spread.Sheets.LineBorder("#00FFFF",GC.Spread.Sheets.LineStyle.medium));
sheet.getRange(-1, 5, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderTop(new GC.Spread.Sheets.LineBorder("#F0FFFF",GC.Spread.Sheets.LineStyle.medium));
sheet.getRange(-1, 5, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderLeft(new GC.Spread.Sheets.LineBorder("#F5F5DC",GC.Spread.Sheets.LineStyle.medium));
sheet.getRange(-1, 5, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderRight(new GC.Spread.Sheets.LineBorder("#FF02FF", GC.Spread.Sheets.LineStyle.dashDot));
sheet.getRange(-1, 5, -1, 1, GC.Spread.Sheets.SheetArea.viewport).borderBottom (new GC.Spread.Sheets.LineBorder("#FFE4C4",GC.Spread.Sheets.LineStyle.thin));
sheet.getRange(2, 2, 2, 2, GC.Spread.Sheets.SheetArea.viewport).setBorder(new GC.Spread.Sheets.LineBorder("#8A2BE2",GC.Spread.Sheets.LineStyle.thick), { all:true });
sheet.getRange(5, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderTop( new GC.Spread.Sheets.LineBorder("#A52A2A",GC.Spread.Sheets.LineStyle.mediumDashed));
sheet.getRange(5, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderLeft( new GC.Spread.Sheets.LineBorder("#FF02FF",GC.Spread.Sheets.LineStyle.medium));
sheet.getRange(5, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderRight(new GC.Spread.Sheets.LineBorder("#5F9EA0", GC.Spread.Sheets.LineStyle.dashDot));
sheet.getRange(5, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).borderBottom(new GC.Spread.Sheets.LineBorder("#6495ED",GC.Spread.Sheets.LineStyle.dotted));
sheet.getRange(5, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).diagonalUp(new GC.Spread.Sheets.LineBorder("#FF02FF",GC.Spread.Sheets.LineStyle.dotted));
sheet.getRange(5, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).diagonalDown(new GC.Spread.Sheets.LineBorder("#6495ED",GC.Spread.Sheets.LineStyle.medium));

Parameters

Name Type Description
border LineBorder The border line.
option ISetBorderOptions Determines which part of the cell range to set, the option object contains {all:true, left:true, top:true, right:true, bottom:true, diagonalUp:true, diagonalDown:true, outline:true,inside:true, innerHorizontal:true, innerVertical:true}

Returns

void


setStyle

setStyle(value): void

Sets the style for the cell.

example

let style = new GC.Spread.Sheets.Style();
style.formatter = "#,##0.00";
sheet.getRange("E5:F10").setStyle(style);
sheet.getRange(0,0,4,4).setStyle(style);

Parameters

Name Type Description
value Style The style.

Returns

void


setStyleName

setStyleName(value): void

Sets the style name for the cell.

example

let style = new GC.Spread.Sheets.Style();
style.name = "bold_style";
style.font = "bold 12px sans-serif";
sheet.addNamedStyle(style);
sheet.getRange("A1:D3").setStyleName("bold_style");
sheet.getRange(5,5,10,10).setStyleName("bold_style");

Parameters

Name Type Description
value string The style name.

Returns

void


showEllipsis

showEllipsis(value?): any

Gets or sets the cell ellipsis property.

example

activeSheet.getRange(2,-1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).showEllipsis(false);
activeSheet.setText(2,0,"This is a test");

example

activeSheet.getCell(1,1).showEllipsis(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the cell ellipsis property.


shrinkToFit

shrinkToFit(value?): any

Gets or sets whether the cell shrinks the text to fit the cell size.

example

activeSheet.getRange(2,-1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).shrinkToFit(false);
activeSheet.setText(2,0,"This is a test");

example

activeSheet.getCell(1,1).shrinkToFit(true);

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).shrinkToFit(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the cell shrinks the text to fit; otherwise, returns the cell.


tabStop

tabStop(value?): any

Gets or sets a value that indicates whether the user can set focus to the cell using the Tab key.

example

activeSheet.getCell(1,1).tabStop(false);
activeSheet.getRange(1, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).tabStop(false);
activeSheet.getRange(-1, 1, -1, 1, GC.Spread.Sheets.SheetArea.viewport).tabStop(false);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the user can set focus to the cell using the Tab key; otherwise, returns the cell.


tag

tag(value?): any

Gets or sets the tag for the cell.

example

activeSheet.getCell(1,1).tag("cell tag");

Parameters

Name Type
value? any

Returns

any

If no value is set, returns the tag value; otherwise, returns the cell.


text

text(value?): any

Gets or sets the formatted text for the cell.

example

activeSheet.getCell(1,1).text("cell object");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell text; otherwise, returns the cell.


textDecoration

textDecoration(value?): any

Gets or sets the type of the decoration added to the cell's text.

example

activeSheet.getRange(1, -1, 1, -1).textDecoration(GC.Spread.Sheets.TextDecorationType.overline | GC.Spread.Sheets.TextDecorationType.underline);

Parameters

Name Type
value? TextDecorationType

Returns

any

If no value is set, returns the type of the decoration; otherwise, returns the cell.


textIndent

textIndent(value?): any

Gets or sets the text indent of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).textIndent(1);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the cell text indent; otherwise, returns the cell.


textOrientation

textOrientation(value?): any

Gets or sets the text rotation angle of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).textOrientation(66);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the cell text rotation angle; otherwise, returns the cell.


themeFont

themeFont(value?): any

Gets or sets the theme font for the cell.

example

activeSheet.getCell(-1, 0).themeFont("Body");
activeSheet.getCell(0,0).value("Test");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the cell's theme font; otherwise, returns the cell.


toHtml

toHtml(headerOptions?, includeStyle?): string

Gets the HTML content from the specified area.

example

activeSheet.getRange(0, 0, 10, 10).toHtml();

Parameters

Name Type
headerOptions? HeaderOptions
includeStyle? boolean

Returns

string

The HTML content that contains cell text, cell span and cell style.


vAlign

vAlign(value?): any

Gets or sets the vertical alignment of the contents of the cell.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).vAlign(GC.Spread.Sheets.VerticalAlign.top);

Parameters

Name Type
value? VerticalAlign

Returns

any

If no value is set, returns the vertical alignment of the contents of the cell; otherwise, returns the cell.


validator

validator(value?): any

Gets or sets the data validator for the cell.

example

spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createDateValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, new Date(2012, 11, 31), new Date(2013, 11, 31));
dv.showInputMessage(true);
dv.inputMessage("Enter a date between 12/31/2012 and 12/31/2013.");
dv.inputTitle("Tip");
activeSheet.getCell(0,0).validator(dv);

example

spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createDateValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, new Date(2012, 11, 31), new Date(2013, 11, 31));
dv.showInputMessage(true);
dv.inputMessage("Enter a date between 12/31/2012 and 12/31/2013.");
dv.inputTitle("Tip");
activeSheet.getCell(1, -1).validator(dv);

example

spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createListValidator("1,2,3");
dv.showInputMessage(true);
dv.inputMessage("Value must be 1,2 or 3");
dv.inputTitle("tip");
activeSheet.setDataValidator(-1,0,dv);

Parameters

Name Type Description
value? DefaultDataValidator The cell data validator.

Returns

any

If no value is set, returns the cell data validator; otherwise, returns the cell.


value

value(value?): any

Gets or sets the unformatted value of the cell.

example

activeSheet.getCell(1,1).value(10);

Parameters

Name Type
value? any

Returns

any

If no value is set, returns the cell value; otherwise, returns the cell.


visible

visible(value?): any

Gets or sets whether the row or column is displayed.

example

activeSheet.getCell(-1, 0).visible(false);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns the visible of the row or column; otherwise, returns the row or column.


watermark

watermark(value?): any

Gets or sets the content of the cell watermark.

example

activeSheet.getCell(1,1).watermark("lightgreen");

Parameters

Name Type
value? string

Returns

any

If no value is set, returns the content of the watermark; otherwise, returns the cell.


width

width(value?): any

Gets or sets the width of the column in pixels.

example

activeSheet.getCell(-1, 0).width(20);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the column width; otherwise, returns the column.


wordWrap

wordWrap(value?): any

Gets or sets whether the cell lets text wrap.

example

activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).wordWrap(true);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether the cell lets text wrap; otherwise, returns the cell.