[]
• new CellRange(sheet
, row
, col
, rowCount?
, colCount?
, sheetArea?
)
Represents a cell range in a sheet.
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 |
- |
• col: number
Gets the starting column index.
• colCount: number
Gets the column count.
• row: number
Gets the starting row index.
• rowCount: number
Gets the row count.
• sheet: Worksheet
Gets the sheet that contains this cell range.
• sheetArea: SheetArea
Gets the area that contains this cell range.
▸ 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}");
Name | Type | Description |
---|---|---|
value? |
any |
The alternative text of the cell. |
any
If no value is set, returns the alternative text of the cell; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string | IGradientFill | IGradientPathFill | IPatternFill |
any
If no value is set, returns the cell background color; otherwise, returns the cell.
▸ backgroundImage(value?
): any
Gets or sets the background image for the cell.
example
activeSheet.getCell(1,1).backgroundImage("images/example.jpg");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell background image; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
ImageLayout |
any
If no value is set, returns the cell background image layout; otherwise, returns the cell.
▸ 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));
Name | Type | Description |
---|---|---|
path? |
string |
The binding path for cell binding. |
any
If no value is set, returns the binding path for cell binding; otherwise, returns the worksheet.
▸ 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));
Name | Type |
---|---|
value? |
LineBorder |
any
If no value is set, returns the cell bottom border line; otherwise, returns the cell.
▸ 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));
Name | Type |
---|---|
value? |
LineBorder |
any
If no value is set, returns the cell left border line; otherwise, returns the cell.
▸ 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));
Name | Type |
---|---|
value? |
LineBorder |
any
If no value is set, returns the cell right border line; otherwise, returns the cell.
▸ 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));
Name | Type |
---|---|
value? |
LineBorder |
any
If no value is set, returns the cell top border line; otherwise, returns the cell.
▸ 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();
Name | Type | Description |
---|---|---|
value? |
ICellButton [] |
the cellButtons of the cell. |
any
If no value is set, returns the cellButtons of the cell; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the value of the cell padding; otherwise, returns the cell.
▸ 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());
Name | Type |
---|---|
value? |
Base |
any
If no value is set, returns the cell type; otherwise, returns the cell.
▸ clear(type
): void
Clears the specified area.
Name | Type | Description |
---|---|---|
type |
StorageType |
The clear type. |
void
▸ 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);
Name | Type | Description |
---|---|---|
value? |
Comment |
The comment to set in the cell. |
any
If no value is set, returns the comment in the cell; otherwise, returns the cell range.
▸ 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");
Name | Type |
---|---|
value? |
any |
any
If no value is set, returns the cell default value; otherwise, returns the cell.
▸ 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));
Name | Type |
---|---|
value? |
LineBorder |
any
If no value is set, returns the cell diagonalDown line; otherwise, returns the cell.
▸ 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));
Name | Type |
---|---|
value? |
LineBorder |
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();
Name | Type |
---|---|
value? |
IDropdown [] |
any
If no value is set, returns the dropDowns of the cell; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell's font; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell's fontFamily; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell's fontSize; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell's fontStyle; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell's fontWeight; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell foreground color; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string | GeneralFormatter |
any
If no value is set, returns the cell formatter string or object; otherwise, returns the cell.
▸ formula(value?
, autoAdjustReference?
): 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\")");
activeSheet.getRange(2,2,100,1).formula("=A3+$A$1"); // all the cells are "=A3+$A$1"
activeSheet.getRange(2,2,100,1).formula("=A3+$A$1", true); // the first cell is "=A3+$A$1", the second cell is "=A4+$A$1", ...
Name | Type |
---|---|
value? |
string |
autoAdjustReference? |
boolean |
any
If no value is set, returns the cell formula; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
HorizontalAlign |
any
If no value is set, returns the horizontal alignment of the contents of the cell; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the row height; otherwise, returns the row.
▸ hidden(value?
): any
Gets or sets whether the cell formula is visible.
example
activeSheet.getRange(-1, 3, -1, 1, GC.Spread.Sheets.SheetArea.viewport).hidden(true);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the cell formula is hidden; otherwise, returns the cell.
▸ imeMode(value?
): any
Gets or sets the imeMode of the cell.
deprecated
This property currently only works in Internet Explorer.
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);
Name | Type |
---|---|
value? |
ImeMode |
any
If no value is set, returns the cell imeMode; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the cell's text vertical; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
ILabelOptions |
any
If no value is set, returns the value of the cell label options; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the cell is locked; otherwise, returns the cell.
▸ 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});
Name | Type |
---|---|
value? |
IMaskType |
any
If no value is set, returns the value of the cell mask; otherwise, returns the cell.
▸ quotePrefix(value?
): any
Gets or sets the quote prefix of the cell.
example
activeSheet.getCell(1,1).quotePrefix(true);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns the content of the quotePrefix; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the user can resize the row; otherwise, returns the row or column.
▸ 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));
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} |
void
▸ 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);
Name | Type | Description |
---|---|---|
value |
Style |
The style. |
void
▸ 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");
Name | Type | Description |
---|---|---|
value |
string |
The style name. |
void
▸ 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);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the cell ellipsis property.
▸ 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);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the cell shrinks the text to fit; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
boolean |
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(value?
): any
Gets or sets the tag for the cell.
example
activeSheet.getCell(1,1).tag("cell tag");
Name | Type |
---|---|
value? |
any |
any
If no value is set, returns the tag value; otherwise, returns the cell.
▸ text(value?
): any
Gets or sets the formatted text for the cell.
example
activeSheet.getCell(1,1).text("cell object");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell text; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
TextDecorationType |
any
If no value is set, returns the type of the decoration; otherwise, returns the cell.
▸ textDirection(value?
): any
Gets or sets the type of the direction added to the cell's text.
example
activeSheet.getRange(1, -1, 1, -1).textDirection(GC.Spread.Sheets.TextDirectionType.rightToLeft);
Name | Type |
---|---|
value? |
TextDirectionType |
any
If no value is set, returns the type of the direction; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the cell text indent; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the cell text rotation angle; otherwise, returns the cell.
▸ 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");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the cell's theme font; otherwise, returns the cell.
▸ toHtml(headerOptions?
, includeStyle?
): string
Gets the HTML content from the specified area.
example
activeSheet.getRange(0, 0, 10, 10).toHtml();
Name | Type |
---|---|
headerOptions? |
HeaderOptions |
includeStyle? |
boolean |
string
The HTML content that contains cell text, cell span and cell style.
▸ 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);
Name | Type |
---|---|
value? |
VerticalAlign |
any
If no value is set, returns the vertical alignment of the contents of the cell; otherwise, returns the cell.
▸ 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);
Name | Type |
---|---|
value? |
DefaultDataValidator |
any
If no value is set, returns the cell data validator; otherwise, returns the cell.
▸ value(value?
): any
Gets or sets the unformatted value of the cell.
example
activeSheet.getCell(1,1).value(10);
Name | Type |
---|---|
value? |
any |
any
If no value is set, returns the cell value; otherwise, returns the cell.
▸ visible(value?
): any
Gets or sets whether the row or column is displayed.
example
activeSheet.getCell(-1, 0).visible(false);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns the visible of the row or column; otherwise, returns the row or column.
▸ watermark(value?
): any
Gets or sets the content of the cell watermark.
example
activeSheet.getCell(1,1).watermark("lightgreen");
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the content of the watermark; otherwise, returns the cell.
▸ width(value?
): any
Gets or sets the width of the column in pixels.
example
activeSheet.getCell(-1, 0).width(20);
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the column width; otherwise, returns the column.
▸ 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);
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether the cell lets text wrap; otherwise, returns the cell.