[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
在线咨询 立即试用
(Showing Draft Content)

GC.Spread.Sheets.CellTypes.Text

Class: Text

Sheets.CellTypes.Text

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new Text(editorType?)

表示文本单元格类型。

example

// 为单元格设置文本单元格类型
var textCellType = new GC.Spread.Sheets.CellTypes.Text(GC.Spread.Sheets.CellTypes.EditorType.textarea);
sheet.setCellType(1, 1, textCellType);

Parameters

Name Type Description
editorType? EditorType 文本单元格类型的编辑器类型。

Overrides

Base.constructor

Properties

typeName

• typeName: string

表示用于支持序列化的类型名称字符串。

Inherited from

Base.typeName

Methods

activateEditor

▸ activateEditor(editorContext, cellStyle, cellRect, context?): void

激活编辑器,包括设置编辑器的属性或属性以及绑定编辑器的事件。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
cellStyle Style 单元格的实际样式。
cellRect Rect 单元格的布局信息。
context? any 与单元格类型相关的上下文。

Returns

void

Inherited from

Base.activateEditor


createEditorElement

▸ createEditorElement(context?): HTMLElement

创建一个 DOM 元素并返回它。

Parameters

Name Type Description
context? any 与单元格类型相关的上下文。

Returns

HTMLElement

返回一个 DOM 元素。

Inherited from

Base.createEditorElement


deactivateEditor

▸ deactivateEditor(editorContext, context?): void

停用编辑器,例如取消绑定编辑器的事件。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
context? any 与单元格类型相关的上下文。

Returns

void

Inherited from

Base.deactivateEditor


focus

▸ focus(editorContext, context?): void

聚焦编辑器 DOM 元素。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
context? any 与单元格类型相关的上下文。

Returns

void

Inherited from

Base.focus


format

▸ format(value, format, formattedData?, context?): string

使用指定的格式格式化一个值。

Parameters

Name Type Description
value any 要格式化的对象值。
format string | GeneralFormatter 格式。
formattedData? FormattedData 格式化的数据。
context? any 与单元格类型相关的上下文。

Returns

string

返回格式化的字符串。

Inherited from

Base.format


fromJSON

▸ fromJSON(settings): void

从指定的 JSON 字符串加载对象状态。

Parameters

Name Type Description
settings any 从反序列化获取的单元格类型数据。

Returns

void

Inherited from

Base.fromJSON


getAutoFitHeight

▸ getAutoFitHeight(value, text, cellStyle, zoomFactor, context?): number

获取一个单元格的高度,可以用于处理行自动适应。

Parameters

Name Type Description
value any 单元格的值。
text string 单元格的文本。
cellStyle Style 单元格的实际值。
zoomFactor number 当前工作表的缩放因子。
context? any 与单元格类型相关的上下文。

Returns

number

返回单元格的高度,可以用于处理行自动适应。

Inherited from

Base.getAutoFitHeight


getAutoFitWidth

▸ getAutoFitWidth(value, text, cellStyle, zoomFactor, context?): number

获取一个单元格的宽度,可以用于处理列自动适应。

Parameters

Name Type Description
value any 单元格的值。
text string 单元格的文本。
cellStyle Style 单元格的实际值。
zoomFactor number 当前工作表的缩放因子。
context? any 与单元格类型相关的上下文。

Returns

number

返回单元格的宽度,可以用于处理列自动适应。

Inherited from

Base.getAutoFitWidth


getEditorValue

▸ getEditorValue(editorContext, context?): any

获取编辑器的值。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
context? any 与单元格类型相关的上下文。

Returns

any

返回编辑器的值。

Inherited from

Base.getEditorValue


getHitInfo

▸ getHitInfo(x, y, cellStyle, cellRect, context?): IHitTestCellTypeHitInfo

获取单元格类型的命中信息。

Parameters

Name Type Description
x number 指针当前位置相对于画布的 x 坐标。
y number 指针当前位置相对于画布的 y 坐标。
cellStyle Style 当前单元格的实际样式。
cellRect Rect 当前单元格的布局信息。
context? any 与单元格类型相关的上下文。

Returns

IHitTestCellTypeHitInfo

返回一个包含 x, y, row, col, cellRect 和 sheetArea 参数的对象,以及一个指示 isReservedLocation 的值。 isReservedLocation 为 true 表示命中测试在单元格类型需要处理的特殊区域;否则为 false。

Inherited from

Base.getHitInfo


isEditingValueChanged

▸ isEditingValueChanged(oldValue, newValue, context?): boolean

编辑值是否已更改。

Parameters

Name Type Description
oldValue any 旧的编辑值。
newValue any 新的编辑值。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

boolean

如果 oldValue 等于 newValue,则返回 true;否则返回 false。

Inherited from

Base.isEditingValueChanged


isImeAware

▸ isImeAware(context?): boolean

此单元格类型是否支持 IME。

Parameters

Name Type Description
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

boolean

如果单元格类型支持 IME,则返回 true;否则返回 false。

Inherited from

Base.isImeAware


isReservedKey

▸ isReservedKey(e, context?): boolean

单元格类型是否自行处理键盘事件。

Parameters

Name Type Description
e KeyboardEvent 键盘事件。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

boolean

如果单元格类型自行处理键盘事件,则返回 true;否则返回 false。

Inherited from

Base.isReservedKey


paint

▸ paint(ctx, value, x, y, w, h, style, context?): void

在画布上绘制单元格。

Parameters

Name Type Description
ctx CanvasRenderingContext2D 画布的二维上下文。
value any 单元格的值。
x number 相对于画布的 x 坐标。
y number 相对于画布的 y 坐标。
w number 单元格的宽度。
h number 单元格的高度。
style Style 单元格的实际样式。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

void

Inherited from

Base.paint


paintContent

▸ paintContent(ctx, value, x, y, w, h, style, context?): void

在画布上绘制单元格内容区域。

Parameters

Name Type Description
ctx CanvasRenderingContext2D 画布的二维上下文。
value any 单元格的值。
x number 相对于画布的 x 坐标。
y number 相对于画布的 y 坐标。
w number 单元格内容区域的宽度。
h number 单元格内容区域的高度。
style Style 单元格的实际样式。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

void

Inherited from

Base.paintContent


parse

▸ parse(text, formatStr, context?): any

使用指定的格式字符串将文本解析为对象。

Parameters

Name Type Description
text string 要解析的文本字符串。
formatStr string 解析格式字符串。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

any

解析后的对象。

Inherited from

Base.parse


processKeyDown

▸ processKeyDown(event, context?): boolean

在显示模式下处理按键按下事件。

Parameters

Name Type Description
event KeyboardEvent 键盘事件。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processKeyDown


processKeyUp

▸ processKeyUp(event, context?): boolean

在显示模式下处理按键释放事件。

Parameters

Name Type Description
event KeyboardEvent 键盘事件。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processKeyUp


processMouseDown

▸ processMouseDown(hitInfo): boolean

在显示模式下处理鼠标按下事件。

Parameters

Name Type Description
hitInfo IHitTestCellTypeHitInfo 由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processMouseDown


processMouseEnter

▸ processMouseEnter(hitInfo): boolean

在显示模式下处理鼠标进入事件。

Parameters

Name Type Description
hitInfo IHitTestCellTypeHitInfo 由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processMouseEnter


processMouseLeave

▸ processMouseLeave(hitInfo): boolean

在显示模式下处理鼠标离开事件。

Parameters

Name Type Description
hitInfo IHitTestCellTypeHitInfo 由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processMouseLeave


processMouseMove

▸ processMouseMove(hitInfo): boolean

在显示模式下处理鼠标移动事件。

Parameters

Name Type Description
hitInfo IHitTestCellTypeHitInfo 由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processMouseMove


processMouseUp

▸ processMouseUp(hitInfo): boolean

在显示模式下处理鼠标释放事件。

Parameters

Name Type Description
hitInfo IHitTestCellTypeHitInfo 由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。

Returns

boolean

如果处理成功则返回 true;否则返回 false。

Inherited from

Base.processMouseUp


selectAll

▸ selectAll(editorContext, context?): void

选择编辑器 DOM 元素中的所有文本。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

void

Inherited from

Base.selectAll


setEditorValue

▸ setEditorValue(editorContext, value, context?): void

设置编辑器的值。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
value any 由活动单元格返回的值。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

void

Inherited from

Base.setEditorValue


toJSON

▸ toJSON(): any

将对象状态保存为 JSON 字符串。

Returns

any

单元格类型数据。

Inherited from

Base.toJSON


updateEditor

▸ updateEditor(editorContext, cellStyle, cellRect, context?): Rect

更新编辑器的大小。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
cellStyle Style 单元格的实际样式。
cellRect Rect 单元格的布局信息。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

Rect

返回单元格包装元素的新大小,它应包含 'width' 和 'height' 两个属性。

Inherited from

Base.updateEditor


updateEditorContainer

▸ updateEditorContainer(editorContext, editorBounds, cellStyle): void

更新单元格包装元素的大小。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
editorBounds Rect 单元格包装元素的新大小。
cellStyle Style 单元格的实际样式。

Returns

void

Inherited from

Base.updateEditorContainer


updateImeMode

▸ updateImeMode(editorContext, imeMode, context?): void

更新编辑器的输入法模式。

Parameters

Name Type Description
editorContext HTMLElement 由 createEditorElement 方法创建的 DOM 元素。
imeMode ImeMode 来自单元格实际样式的输入法模式。
context? any 与单元格类型相关的上下文。有关更多信息,请参阅备注。

Returns

void

Inherited from

Base.updateImeMode