[]
↳ Text
↳↳ DataObject
↳↳ Diagonal
• new Text(editorType?)
表示文本单元格类型。
example
// 为单元格设置文本单元格类型
var textCellType = new GC.Spread.Sheets.CellTypes.Text(GC.Spread.Sheets.CellTypes.EditorType.textarea);
sheet.setCellType(1, 1, textCellType);
| Name | Type | Description |
|---|---|---|
editorType? |
EditorType |
文本单元格类型的编辑器类型。 |
• typeName: string
表示用于支持序列化的类型名称字符串。
▸ activateEditor(editorContext, cellStyle, cellRect, context?): void
激活编辑器,包括设置编辑器的属性或属性以及绑定编辑器的事件。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
cellStyle |
Style |
单元格的实际样式。 |
cellRect |
Rect |
单元格的布局信息。 |
context? |
any |
与单元格类型相关的上下文。 |
void
▸ createEditorElement(context?): HTMLElement
创建一个 DOM 元素并返回它。
| Name | Type | Description |
|---|---|---|
context? |
any |
与单元格类型相关的上下文。 |
HTMLElement
返回一个 DOM 元素。
▸ deactivateEditor(editorContext, context?): void
停用编辑器,例如取消绑定编辑器的事件。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
context? |
any |
与单元格类型相关的上下文。 |
void
▸ focus(editorContext, context?): void
聚焦编辑器 DOM 元素。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
context? |
any |
与单元格类型相关的上下文。 |
void
▸ format(value, format, formattedData?, context?): string
使用指定的格式格式化一个值。
| Name | Type | Description |
|---|---|---|
value |
any |
要格式化的对象值。 |
format |
string | GeneralFormatter |
格式。 |
formattedData? |
FormattedData |
格式化的数据。 |
context? |
any |
与单元格类型相关的上下文。 |
string
返回格式化的字符串。
▸ fromJSON(settings): void
从指定的 JSON 字符串加载对象状态。
| Name | Type | Description |
|---|---|---|
settings |
any |
从反序列化获取的单元格类型数据。 |
void
▸ getAutoFitHeight(value, text, cellStyle, zoomFactor, context?): number
获取一个单元格的高度,可以用于处理行自动适应。
| Name | Type | Description |
|---|---|---|
value |
any |
单元格的值。 |
text |
string |
单元格的文本。 |
cellStyle |
Style |
单元格的实际值。 |
zoomFactor |
number |
当前工作表的缩放因子。 |
context? |
any |
与单元格类型相关的上下文。 |
number
返回单元格的高度,可以用于处理行自动适应。
▸ getAutoFitWidth(value, text, cellStyle, zoomFactor, context?): number
获取一个单元格的宽度,可以用于处理列自动适应。
| Name | Type | Description |
|---|---|---|
value |
any |
单元格的值。 |
text |
string |
单元格的文本。 |
cellStyle |
Style |
单元格的实际值。 |
zoomFactor |
number |
当前工作表的缩放因子。 |
context? |
any |
与单元格类型相关的上下文。 |
number
返回单元格的宽度,可以用于处理列自动适应。
▸ getEditorValue(editorContext, context?): any
获取编辑器的值。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
context? |
any |
与单元格类型相关的上下文。 |
any
返回编辑器的值。
▸ getHitInfo(x, y, cellStyle, cellRect, context?): IHitTestCellTypeHitInfo
获取单元格类型的命中信息。
| Name | Type | Description |
|---|---|---|
x |
number |
指针当前位置相对于画布的 x 坐标。 |
y |
number |
指针当前位置相对于画布的 y 坐标。 |
cellStyle |
Style |
当前单元格的实际样式。 |
cellRect |
Rect |
当前单元格的布局信息。 |
context? |
any |
与单元格类型相关的上下文。 |
返回一个包含 x, y, row, col, cellRect 和 sheetArea 参数的对象,以及一个指示 isReservedLocation 的值。
isReservedLocation 为 true 表示命中测试在单元格类型需要处理的特殊区域;否则为 false。
▸ isEditingValueChanged(oldValue, newValue, context?): boolean
编辑值是否已更改。
| Name | Type | Description |
|---|---|---|
oldValue |
any |
旧的编辑值。 |
newValue |
any |
新的编辑值。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
boolean
如果 oldValue 等于 newValue,则返回 true;否则返回 false。
▸ isImeAware(context?): boolean
此单元格类型是否支持 IME。
| Name | Type | Description |
|---|---|---|
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
boolean
如果单元格类型支持 IME,则返回 true;否则返回 false。
▸ isReservedKey(e, context?): boolean
单元格类型是否自行处理键盘事件。
| Name | Type | Description |
|---|---|---|
e |
KeyboardEvent |
键盘事件。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
boolean
如果单元格类型自行处理键盘事件,则返回 true;否则返回 false。
▸ paint(ctx, value, x, y, w, h, style, context?): void
在画布上绘制单元格。
| Name | Type | Description |
|---|---|---|
ctx |
CanvasRenderingContext2D |
画布的二维上下文。 |
value |
any |
单元格的值。 |
x |
number |
相对于画布的 x 坐标。 |
y |
number |
相对于画布的 y 坐标。 |
w |
number |
单元格的宽度。 |
h |
number |
单元格的高度。 |
style |
Style |
单元格的实际样式。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
void
▸ paintContent(ctx, value, x, y, w, h, style, context?): void
在画布上绘制单元格内容区域。
| Name | Type | Description |
|---|---|---|
ctx |
CanvasRenderingContext2D |
画布的二维上下文。 |
value |
any |
单元格的值。 |
x |
number |
相对于画布的 x 坐标。 |
y |
number |
相对于画布的 y 坐标。 |
w |
number |
单元格内容区域的宽度。 |
h |
number |
单元格内容区域的高度。 |
style |
Style |
单元格的实际样式。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
void
▸ parse(text, formatStr, context?): any
使用指定的格式字符串将文本解析为对象。
| Name | Type | Description |
|---|---|---|
text |
string |
要解析的文本字符串。 |
formatStr |
string |
解析格式字符串。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
any
解析后的对象。
▸ processKeyDown(event, context?): boolean
在显示模式下处理按键按下事件。
| Name | Type | Description |
|---|---|---|
event |
KeyboardEvent |
键盘事件。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ processKeyUp(event, context?): boolean
在显示模式下处理按键释放事件。
| Name | Type | Description |
|---|---|---|
event |
KeyboardEvent |
键盘事件。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ processMouseDown(hitInfo): boolean
在显示模式下处理鼠标按下事件。
| Name | Type | Description |
|---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ processMouseEnter(hitInfo): boolean
在显示模式下处理鼠标进入事件。
| Name | Type | Description |
|---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ processMouseLeave(hitInfo): boolean
在显示模式下处理鼠标离开事件。
| Name | Type | Description |
|---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ processMouseMove(hitInfo): boolean
在显示模式下处理鼠标移动事件。
| Name | Type | Description |
|---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ processMouseUp(hitInfo): boolean
在显示模式下处理鼠标释放事件。
| Name | Type | Description |
|---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
由 getHitInfo 方法返回的命中测试信息。有关更多信息,请参阅备注。 |
boolean
如果处理成功则返回 true;否则返回 false。
▸ selectAll(editorContext, context?): void
选择编辑器 DOM 元素中的所有文本。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
void
▸ setEditorValue(editorContext, value, context?): void
设置编辑器的值。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
value |
any |
由活动单元格返回的值。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
void
▸ toJSON(): any
将对象状态保存为 JSON 字符串。
any
单元格类型数据。
▸ updateEditor(editorContext, cellStyle, cellRect, context?): Rect
更新编辑器的大小。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
cellStyle |
Style |
单元格的实际样式。 |
cellRect |
Rect |
单元格的布局信息。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
返回单元格包装元素的新大小,它应包含 'width' 和 'height' 两个属性。
▸ updateEditorContainer(editorContext, editorBounds, cellStyle): void
更新单元格包装元素的大小。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
editorBounds |
Rect |
单元格包装元素的新大小。 |
cellStyle |
Style |
单元格的实际样式。 |
void
▸ updateImeMode(editorContext, imeMode, context?): void
更新编辑器的输入法模式。
| Name | Type | Description |
|---|---|---|
editorContext |
HTMLElement |
由 createEditorElement 方法创建的 DOM 元素。 |
imeMode |
ImeMode |
来自单元格实际样式的输入法模式。 |
context? |
any |
与单元格类型相关的上下文。有关更多信息,请参阅备注。 |
void