Show.TableCell
Show.TableCell is an object type of the Presentation module (Office.show(iframe)). 57 methods.
Presentation · 10 object types · 586 methods · namespace Show. This reference is generated from the API document artifact (sdk-api-doc.html) produced with the SDK build. Descriptions are the editor's API comments as published. Pin the SDK and Office versions together and regenerate when either changes.
Remarks
- Module: Presentation ·
Office.show(iframe)· namespaceShow - Obtained from:
Table.findCells(filter),Table.getCell(row, col),Table.getCells(),Table.getColumn(colIndex),Table.getRow(rowIndex) - Every method returns a
Promise; signatures use TypeScript notation.
Methods
| Method | Description |
|---|---|
deleteText() | Removes all text inside the cell. |
getAlignH(range) | Returns the representative paragraph's horizontal alignment. |
getAlignV() | Returns the vertical text alignment. |
getBold(range) | Returns whether the representative run is bold. |
getBorderStyle(position) | Returns the border style of the cell at the given position. |
getBulletStyle(range) | Returns the bullet style of the representative paragraph. |
getColIndex() | Returns the cell's column index. |
getColSpan() | Returns the number of columns the cell spans horizontally. |
getFill() | Returns the background fill set explicitly on the cell. |
getFirstLineIndent(range) | Returns the representative paragraph's first-line indent (UI "first line"). |
getFontFamily(range) | Returns the font name of the representative run. |
getFontSize(range) | Returns the font size (pt) of the representative run. |
getFontStyle(range) | Returns the font style of the representative run (the first run the range touches). |
getItalic(range) | Returns whether the representative run is italic. |
getLevel(range) | Returns the representative paragraph's list level. |
getLineSpacing(range) | Returns the representative paragraph's line-spacing value. |
getLineSpacingType(range) | Returns the representative paragraph's line-spacing type. |
getMarginLeft(range) | Returns the representative paragraph's left margin (UI "before text"). |
getParagraphStyle(range) | Returns the paragraph format of the representative paragraph (the first paragraph the range touches). |
getRowIndex() | Returns the cell's row index. |
getRowSpan() | Returns the number of rows the cell spans vertically. |
getSpaceAfter(range) | Returns the representative paragraph's space after (UI "below paragraph"). |
getSpaceBefore(range) | Returns the representative paragraph's space before (UI "above paragraph"). |
getStrike(range) | Returns the strikethrough type of the representative run. |
getText(range) | Returns the text as plain text. |
getTextboxAutoFit() | Returns the text-box auto-fit type. |
getTextColor(range) | Returns the text color of the representative run. |
getTextHyperlink(range) | Returns the hyperlink of a text span. |
getUnderline(range) | Returns the underline type of the representative run. |
insertSymbol(textOffset, symbol) | Inserts a symbol (special character) at the given offset. |
insertText(text, textOffset) | Inserts text. |
isShape() | Checks whether this handle is a Shape (a type guard for union narrowing). |
removeTextHyperlink(range) | Removes the text's hyperlink. |
setAlignH(align, range) | Sets the text's horizontal alignment. |
setAlignV(align) | Sets the vertical text alignment. |
setBold(enabled, range) | Sets bold text. |
setBorderStyle(position, color, width, lineDash) | Sets the cell border style. |
setBulletStyle(bulletType, subType, startAt, range) | Sets the bullet style. |
setFill(fill) | Applies a fill object returned by getFill() as is. |
setFirstLineIndent(firstLineIndent, range) | Sets the indent of the paragraph's first line (UI "First line"). |
setFontFamily(fontFamily, range) | Sets the font. |
setFontSize(fontSize, range) | Sets the font size. |
setFontStyle(style, range) | Sets the font style. |
setItalic(enabled, range) | Sets italic text. |
setLevel(level, range) | Sets the list level (outline depth). |
setLineSpacing(lineSpacing, type, range) | Sets the line spacing. |
setMarginLeft(marginLeft, range) | Sets the left margin of the whole paragraph (UI "Before text"). |
setParagraphStyle(style, range) | Sets the paragraph format in one call. |
setSolidFill(color, alpha) | Fills the cell background with a solid color. |
setSpaceAfter(spaceAfter, range) | Sets the space after the paragraph (UI "below paragraph"). |
setSpaceBefore(spaceBefore, range) | Sets the space before the paragraph (UI "above paragraph"). |
setStrike(strike, range) | Sets strikethrough text. |
setText(text, range) | Sets the text. |
setTextboxAutoFit(autoAlignType) | Sets the text box auto-fit type. |
setTextColor(color, range) | Sets the text color. |
setTextHyperlink(hyperlink, range) | Sets a hyperlink on the text (symmetric with getTextHyperlink - the returned object can be passed back to copy a link). |
setUnderline(underline, range) | Sets underlined text. |
Method details
deleteText()
Removes all text inside the cell.
deleteText(): Promise<void>;
Returns
Promise<void>
getAlignH(range)
Returns the representative paragraph's horizontal alignment. (Symmetric with setAlignH.)
getAlignH(range?: TextRange): Promise<TextAlignH | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<TextAlignH | null> - Horizontal alignment. null if there is no text/paragraph
getAlignV()
Returns the vertical text alignment. (counterpart of setAlignV) TextAlignV is a numeric enum where TOP is 0, so check for a value with a null comparison, not a truthiness test.
getAlignV(): Promise<TextAlignV | null>;
Returns
Promise<TextAlignV | null> - Vertical alignment. null if there is no target text
getBold(range)
Returns whether the representative run is bold. (counterpart of setBold - the effective value including inheritance)
getBold(range?: TextRange): Promise<boolean | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<boolean | null> - Bold state. null if there is no target text or the span is invalid
getBorderStyle(position)
Returns the border style of the cell at the given position. (counterpart of setBorderStyle) Reading ALL at once is not supported - query one side at a time.
getBorderStyle(position: Exclude<BorderPosition, "all">): Promise<BorderStyle | null>;
Parameters
| Name | Type | Description |
|---|---|---|
position | Exclude<BorderPosition, "all"> | Border position |
Returns
Promise<BorderStyle | null> - Border style. null if there is no explicit border at that position
getBulletStyle(range)
Returns the bullet style of the representative paragraph. The returned fields can be spread into setBulletStyle(type, subType, startAt). Values are the effective ones including layout/master inheritance; absent values (start number) and values that cannot be passed back (number types outside the presets) are left out. Picture bullets and characters outside the presets are read-only and cannot be applied as is. (see setBulletStyle for the constraints)
getBulletStyle(range?: TextRange): Promise<BulletStyle | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<BulletStyle | null> - Bullet style. null if there is no text/paragraph
getColIndex()
Returns the cell's column index.
getColIndex(): Promise<number>;
Returns
Promise<number> - Column index (0-based)
getColSpan()
Returns the number of columns the cell spans horizontally. 1 if not merged.
getColSpan(): Promise<number | null>;
Returns
Promise<number | null> - Column span. null if there is no table or no cell at that position
getFill()
Returns the background fill set explicitly on the cell. (counterpart of setSolidFill) Style inheritance is not included (only a fill set directly on the cell), and alpha is returned as the same transparency as setSolidFill (0–100, 0 = opaque).
getFill(): Promise<Fill | null>;
Returns
Promise<Fill | null> - Fill information. \{ type: FillType.NONE \} if there is no explicit fill; null if there is no table
getFirstLineIndent(range)
Returns the representative paragraph's first-line indent (UI "first line"). (Symmetric with setFirstLineIndent.)
getFirstLineIndent(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - First-line indent (pt, negative is a hanging indent). null if there is no text/paragraph
getFontFamily(range)
Returns the font name of the representative run. (counterpart of setFontFamily - the effective value including inheritance)
getFontFamily(range?: TextRange): Promise<string | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<string | null> - Font name. null if there is no target text or the span is invalid
getFontSize(range)
Returns the font size (pt) of the representative run. (counterpart of setFontSize - the effective value including inheritance)
getFontSize(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - Font size (pt). null if there is no target text or the span is invalid
getFontStyle(range)
Returns the font style of the representative run (the first run the range touches). (counterpart of setFontStyle) The returned object can be passed as is to another object's setFontStyle. Properties without a value are left out. Values are the effective ones including layout/master/table-style inheritance, so values set directly on the run cannot be singled out.
getFontStyle(range?: TextRange): Promise<FontStyle | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<FontStyle | null> - Font style. An empty object \{\} if there is no run/style; null if the target text is gone (e.g. deleted during collaboration) or the span is invalid
getItalic(range)
Returns whether the representative run is italic. (counterpart of setItalic - the effective value including inheritance)
getItalic(range?: TextRange): Promise<boolean | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<boolean | null> - Italic state. null if there is no target text or the span is invalid
getLevel(range)
Returns the representative paragraph's list level. (Symmetric with setLevel.)
getLevel(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - List level (1–9). null if there is no text/paragraph
getLineSpacing(range)
Returns the representative paragraph's line-spacing value. (Symmetric with setLineSpacing.)
getLineSpacing(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - Line spacing value (MULTIPLE: percent multiple, EXACT: pt). null if there is no text/paragraph
getLineSpacingType(range)
Returns the representative paragraph's line-spacing type. (Symmetric with setLineSpacing's type.)
getLineSpacingType(range?: TextRange): Promise<LineSpacingType | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<LineSpacingType | null> - Line spacing type. null if there is no text/paragraph
getMarginLeft(range)
Returns the representative paragraph's left margin (UI "before text"). (Symmetric with setMarginLeft.)
getMarginLeft(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - Left margin (pt). null if there is no text/paragraph
getParagraphStyle(range)
Returns the paragraph format of the representative paragraph (the first paragraph the range touches). (counterpart of setParagraphStyle) The returned object can be passed as is to another object's setParagraphStyle. Properties without a value are left out. Values are the effective ones including layout/master inheritance, so values set directly on the paragraph cannot be singled out, and passing them back to the same paragraph does not leave properties equal to the inherited value as direct settings. The list level is not included - it is an inherited preset, not a format value. (see getLevel)
getParagraphStyle(range?: TextRange): Promise<ParagraphStyle | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<ParagraphStyle | null> - Paragraph format. null if there is no text/paragraph
getRowIndex()
Returns the cell's row index.
getRowIndex(): Promise<number>;
Returns
Promise<number> - Row index (0-based)
getRowSpan()
Returns the number of rows the cell spans vertically. 1 if not merged.
getRowSpan(): Promise<number | null>;
Returns
Promise<number | null> - Row span. null if there is no table or no cell at that position
getSpaceAfter(range)
Returns the representative paragraph's space after (UI "below paragraph"). (Symmetric with setSpaceAfter.)
getSpaceAfter(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - Space after the paragraph (pt). null if stored as a multiple (%) or there is no text
getSpaceBefore(range)
Returns the representative paragraph's space before (UI "above paragraph"). (Symmetric with setSpaceBefore.)
getSpaceBefore(range?: TextRange): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<number | null> - Space before the paragraph (pt). null if stored as a multiple (%) or there is no text
getStrike(range)
Returns the strikethrough type of the representative run. (counterpart of setStrike - the effective value including inheritance)
getStrike(range?: TextRange): Promise<Strike | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<Strike | null> - Strikethrough type. null if there is no target text or the span is invalid
getText(range)
Returns the text as plain text. Line breaks between paragraphs are kept, but the line break that ends the last paragraph is not a character and is not included ("" for empty text).
getText(range?: TextRange): Promise<string>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (UTF-16 code unit offsets) (default: the whole text) |
Returns
Promise<string> - Text of the span (plain text). "" if there is no text model or the span is empty
getTextboxAutoFit()
Returns the text-box auto-fit type. (Symmetric with setTextboxAutoFit.)
getTextboxAutoFit(): Promise<AutoFitType | null>;
Returns
Promise<AutoFitType | null> - Auto-fit type. null if there is no target text
getTextColor(range)
Returns the text color of the representative run. (counterpart of setTextColor - the effective value including inheritance)
getTextColor(range?: TextRange): Promise<string | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<string | null> - Text color (hex "#RRGGBB" - scheme colors are resolved to hex). null if the fill is not solid, there is no target text, or the span is invalid
getTextHyperlink(range)
Returns the hyperlink of a text span. (counterpart of setTextHyperlink - the returned object can be passed back to copy the link) With range, the run containing the first character of that span is used; without range, the run containing the first character of the text. A hyperlink attached to the shape itself is read with getHyperlink.
getTextHyperlink(range?: TextRange): Promise<Hyperlink | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to query (default: the first character of the text) |
Returns
Promise<Hyperlink | null> - Hyperlink information (the same Hyperlink object as getHyperlink). null if there is no link, no text, or the action is not exposed
getUnderline(range)
Returns the underline type of the representative run. (counterpart of setUnderline - the effective value including inheritance)
getUnderline(range?: TextRange): Promise<Underline | null>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to read (default: the whole text) |
Returns
Promise<Underline | null> - Underline type. null if there is no target text or the span is invalid
insertSymbol(textOffset, symbol)
Inserts a symbol (special character) at the given offset.
insertSymbol(textOffset: number, symbol: string): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
textOffset | number | Insert position offset |
symbol | string | special character to insert (no line break - use insertText to split paragraphs) |
Returns
Promise<void>
insertText(text, textOffset)
Inserts text. The inserted characters take the run format of the character just before the insertion point.
insertText(text: string, textOffset?: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Text to insert |
textOffset (optional) | number | Insert position offset (default: end of the text) |
Returns
Promise<void>
isShape()
Checks whether this handle is a Shape (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isShape(): Promise<this is Shape>;
Returns
Promise<this is Shape>
removeTextHyperlink(range)
Removes the text's hyperlink. (For a link on the shape itself, removeHyperlink.)
removeTextHyperlink(range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
range (optional) | TextRange | Text span to clear (default: the whole text) |
Returns
Promise<void>
setAlignH(align, range)
Sets the text's horizontal alignment. With range, applies only to the paragraphs that span covers.
setAlignH(align: TextAlignH, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
align | TextAlignH | Horizontal alignment |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setAlignV(align)
Sets the vertical text alignment. (counterpart of getAlignV)
setAlignV(align: TextAlignV): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
align | TextAlignV | Vertical alignment |
Returns
Promise<void>
setBold(enabled, range)
Sets bold text.
setBold(enabled: boolean, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
enabled | boolean | true: bold, false: off |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setBorderStyle(position, color, width, lineDash)
Sets the cell border style. Omitted properties are not kept but reset to defaults, so to change only some of them, pass the value returned by getBorderStyle() with the changed properties overwritten. Omitting all three changes nothing. ALL sets only the four sides (top/bottom/left/right) - diagonals are not included. Colors are detected automatically as hex or scheme color.
setBorderStyle(
position: BorderPosition,
color?: string,
width?: number,
lineDash?: LineDash
): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
position | BorderPosition | Border position |
color (optional) | string | hex (#RRGGBB) or scheme color name |
width (optional) | number | Line width (pt) |
lineDash (optional) | LineDash | Line dash type |
Returns
Promise<void>
setBulletStyle(bulletType, subType, startAt, range)
Sets the bullet style. (counterpart of getBulletStyle) Picture bullets (BulletType.BLIP) are a read-only type that cannot be applied and are rejected. Characters outside the CharType presets cannot be applied either (read-only, with no argument to receive them).
setBulletStyle(
bulletType: Exclude<BulletType, "buBlip">,
subType?: NumberedType | CharType,
startAt?: number,
range?: TextRange
): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
bulletType | Exclude<BulletType, "buBlip"> | Bullet type |
subType (optional) | NumberedType | CharType | BulletType.AUTO_NUM: numbering type (default NumberedType.NUMBER_WITH_DOT), BulletType.CHAR: bullet character type (default CharType.DOT) |
startAt (optional) | number | Start number (used only with BulletType.AUTO_NUM) (default: 1) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setFill(fill)
Applies a fill object returned by getFill() as is. (counterpart of getFill - copies a cell fill) Cell fills support solid colors only - a value from a cell whose getFill() returned another type (none/gradient, etc.) cannot be passed back.
setFill(fill: Fill & { type: "solidFill" }): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
fill | Fill & { type: "solidFill" } | Solid fill to apply |
Returns
Promise<void>
setFirstLineIndent(firstLineIndent, range)
Sets the indent of the paragraph's first line (UI "First line"). Lines from the second onward follow marginLeft. Positive indents, negative creates a hanging indent, 0 means no indent. To change the depth of a bulleted list, use setLevel.
setFirstLineIndent(firstLineIndent: number, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
firstLineIndent | number | First-line indent (pt) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setFontFamily(fontFamily, range)
Sets the font.
setFontFamily(fontFamily: string, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
fontFamily | string | Font name |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setFontSize(fontSize, range)
Sets the font size.
setFontSize(fontSize: number, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
fontSize | number | In pt |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setFontStyle(style, range)
Sets the font style. For single properties prefer setBold/setItalic/setFontSize/setFontFamily/setTextColor.
setFontStyle(style: FontStyle, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
style | FontStyle | Font style settings |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setItalic(enabled, range)
Sets italic text.
setItalic(enabled: boolean, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
enabled | boolean | true: italic, false: off |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setLevel(level, range)
Sets the list level (outline depth). Every paragraph the range touches gets the same level. Unlike the pt-based indents (setFirstLineIndent/setMarginLeft), the level selects an inherited preset, so changing it brings that level's bullet and font size along and overwrites marginLeft with the new level's value. A value set with setMarginLeft is discarded too, so call setLevel first when using both. (firstLineIndent is kept) Clamped to the range the target text allows (title objects have level 1 only).
setLevel(level: number, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
level | number | List level (1 = top level to 9) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setLineSpacing(lineSpacing, type, range)
Sets the line spacing. With range, applies only to the paragraphs that span touches. The unit of lineSpacing depends on the type - a percent multiple for MULTIPLE (150 = 1.5x), pt for EXACT.
setLineSpacing(lineSpacing: number, type?: LineSpacingType, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
lineSpacing | number | Line spacing value (MULTIPLE: percent multiple, EXACT: pt) |
type (optional) | LineSpacingType | Line spacing type (default: LineSpacingType.MULTIPLE) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setMarginLeft(marginLeft, range)
Sets the left margin of the whole paragraph (UI "Before text"). To indent only the first line, use setFirstLineIndent.
setMarginLeft(marginLeft: number, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
marginLeft | number | Left margin (pt) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setParagraphStyle(style, range)
Sets the paragraph format in one call. With range, applies only to the paragraphs that span touches. Only properties given a value change. null/undefined mean "no change", and there is no way yet to revert a set value to the inherited state. For single properties, prefer setLineSpacing/setMarginLeft/setFirstLineIndent/setSpaceBefore/setSpaceAfter. The list level is not included because changing it has side effects (bullet, font size). (see setLevel)
setParagraphStyle(style: ParagraphStyle, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
style | ParagraphStyle | Paragraph format settings |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setSolidFill(color, alpha)
Fills the cell background with a solid color.
setSolidFill(color: string, alpha?: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
color | string | hex (#RRGGBB) or scheme color |
alpha (optional) | number | Transparency (0–100, 0 = opaque, 100 = fully transparent). Keeps the current transparency when omitted |
Returns
Promise<void>
setSpaceAfter(spaceAfter, range)
Sets the space after the paragraph (UI "below paragraph").
setSpaceAfter(spaceAfter: number, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
spaceAfter | number | Space after the paragraph (pt) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setSpaceBefore(spaceBefore, range)
Sets the space before the paragraph (UI "above paragraph").
setSpaceBefore(spaceBefore: number, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
spaceBefore | number | Space before the paragraph (pt) |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setStrike(strike, range)
Sets strikethrough text.
setStrike(strike: Strike, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
strike | Strike | Strikethrough type |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setText(text, range)
Sets the text. Behaves as follows depending on the arguments.
no range: replaces the whole text with text
with range: replaces only that span with text
when text is an empty string (""), deletes the span instead of replacing it
setText(text: string, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Text to set. An empty string ("") deletes |
range (optional) | TextRange | Text span to replace, where to = from + character count - 1 (0-based). E.g. all of "abc" = {from: 0, to: 2}, the "a" in "abc" = {from: 0, to: 0}. Offsets are UTF-16 code units, so a range that splits a surrogate pair covers the whole character rather than half of it (the same holds for the formatting setters that take a range) (default: the whole text) |
Returns
Promise<void>
setTextboxAutoFit(autoAlignType)
Sets the text box auto-fit type. Does nothing if the type is already the same.
setTextboxAutoFit(autoAlignType: AutoFitType): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
autoAlignType | AutoFitType | Auto-fit type |
Returns
Promise<void>
setTextColor(color, range)
Sets the text color.
setTextColor(color: string, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
color | string | hex (#RRGGBB) or scheme color |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setTextHyperlink(hyperlink, range)
Sets a hyperlink on the text (symmetric with getTextHyperlink - the returned object can be passed back to copy a link). Unlike setHyperlink, which links the whole shape, the link applies per text run and is shown with hyperlink formatting. An unsupported kind or an invalid target, such as a deleted slide, is ignored.
setTextHyperlink(hyperlink: Hyperlink, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
hyperlink | Hyperlink | The same Hyperlink object as returned by getTextHyperlink(). Ignored if type is missing |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>
setUnderline(underline, range)
Sets underlined text.
setUnderline(underline: Underline, range?: TextRange): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
underline | Underline | Underline type |
range (optional) | TextRange | Text span to apply to (default: the whole text) |
Returns
Promise<void>