TextBox

TextBox class

Encapsulates the object that represents a textbox in a spreadsheet.

class TextBox extends Shape;

Example

const { Workbook, PlacementType, Color, MsoLineStyle, MsoLineDashStyle, SaveFormat } = AsposeCells;

//Instantiate a new Workbook.
var workbook = new Workbook();
//Get the first worksheet in the book.
var worksheet = workbook.worksheets.get(0);
//Add a new textbox to the collection.
var textboxIndex = worksheet.textBoxes.add(2, 1, 160, 200);
//Get the textbox object.
var textbox0 = worksheet.textBoxes.get(textboxIndex);
//Fill the text.
textbox0.text = "ASPOSE CELLS";
//Set the textbox to adjust it according to its contents.
textbox0.textBody.textAlignment.autoSize = true;
//Set the placement.
textbox0.placement = PlacementType.FreeFloating;
//Set the font color.
textbox0.font.color = Color.Blue;
//Set the font to bold.
textbox0.font.isBold = true;
//Set the font size.
textbox0.font.size = 14;
//Set font attribute to italic.
textbox0.font.isItalic = true;
//Add a hyperlink to the textbox.
textbox0.addHyperlink("https://www.aspose.com/");
//Get the filformat of the textbox.
var fillformat = textbox0.fill;
//Set the fillcolor.
fillformat.solidFill.color = Color.Silver;
//Get the lineformat type of the textbox.
var lineformat = textbox0.line;
//Set the line style.
lineformat.compoundType = MsoLineStyle.ThinThick;
//Set the line weight.
lineformat.weight = 6;
//Set the dash style to squaredot.
lineformat.dashStyle = MsoLineDashStyle.SquareDot;
//Add another textbox.
textboxIndex = worksheet.textBoxes.add(15, 4, 85, 120);
//Get the second textbox.
var textbox1 = worksheet.textBoxes.get(textboxIndex);
//Input some text to it.
textbox1.text = "This is another simple text box";
//Set the placement type as the textbox will move and
//resize with cells.
textbox1.placement = PlacementType.MoveAndSize;
//Save the excel file.
var uint8Array = workbook.save(SaveFormat.Xlsx);

Constructors

NameDescription
constructor(Shape)Constructs from a parent object convertible to this.

Properties

PropertyTypeDescription
macroNamestringGets and sets the name of macro.
isEquationbooleanReadonly. Indicates whether the shape only contains an equation.
isSmartArtbooleanReadonly. Indicates whether the shape is a smart art.
zOrderPositionnumberReturns the position of a shape in the z-order.
namestringGets and sets the name of the shape.
alternativeTextstringReturns or sets the descriptive (alternative) text string of the Shape object.
titlestringSpecifies the title (caption) of the current shape object.
lineLineFormatReadonly. Gets line style
fillFillFormatReadonly. Returns a FillFormat object that contains fill formatting properties for the specified shape.
shadowEffectShadowEffectReadonly. Represents a Drawing.ShadowEffect object that specifies shadow effect for the chart element or shape.
reflectionReflectionEffectReadonly. Represents a ReflectionEffect object that specifies reflection effect for the chart element or shape.
glowGlowEffectReadonly. Represents a GlowEffect object that specifies glow effect for the chart element or shape.
softEdgesnumberGets and sets the radius of blur to apply to the edges, in unit of points.
threeDFormatThreeDFormatReadonly. Gets and sets 3d format of the shape.
formatPictureMsoFormatPictureReadonly. Gets and sets the options of the picture format.
isHiddenbooleanIndicates whether the object is visible.
isLockAspectRatiobooleanTrue means that aspect ratio of the shape is locked.
isAspectRatioLockedbooleanTrue means that aspect ratio of the shape is locked.
rotationAnglenumberGets and sets the rotation of the shape.
hyperlinkHyperlinkReadonly. Gets the hyperlink of the shape.
idnumberReadonly. Gets the identifier of this shape.
spidstringReadonly. Specifies an optional string identifier that an application can use to identify the particular shape.
sptnumberReadonly. Specifies an optional number that an application can use to associate the particular shape with a defined shape type.
worksheetWorksheetReadonly. Gets the Worksheet object which contains this shape.
isGroupbooleanReadonly. Indicates whether this shape is a group shape.
isInGroupbooleanReadonly. Indicates whether the shape is grouped.
isWordArtbooleanReadonly. Indicates whether this shape is a word art.
textEffectTextEffectFormatReadonly. Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Applies to Shape objects that represent WordArt.
isLockedbooleanTrue means the object can not be modified when the sheet is protected. Note that this value is meaningful only if the worksheet or objects in the worksheet are protected.
isPrintablebooleanIndicates whether the object is printable. If False, this shape will not be printed when printing.
msoDrawingTypeMsoDrawingTypeReadonly. Gets drawing type.
autoShapeTypeAutoShapeTypeGets and sets the auto shape type.
anchorTypeShapeAnchorTypeGets and set the type of the shape anchor placeholder.
placementPlacementTypeRepresents the way the drawing object is attached to the cells below it. The property controls the placement of an object on a worksheet.
upperLeftRownumberRepresents the top row index.
upperDeltaYnumberGets or sets the shape’s vertical offset from its upper left corner row.
upperLeftColumnnumberRepresents upper left corner column index.
upperDeltaXnumberGets or sets the shape’s horizontal offset from its upper left corner column.
lowerRightRownumberRepresents lower right corner row index.
lowerDeltaYnumberGets or sets the shape’s vertical offset from its lower right corner row.
lowerRightColumnnumberRepresents lower right corner column index.
lowerDeltaXnumberGets or sets the shape’s horizontal offset from its lower right corner column.
rightnumberRepresents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
bottomnumberRepresents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.
widthnumberRepresents the width of shape, in unit of pixels.
widthInchnumberRepresents the width of the shape, in unit of inch.
widthPtnumberRepresents the width of the shape, in unit of point.
widthCMnumberRepresents the width of the shape, in unit of centimeters.
heightnumberRepresents the height of shape, in unit of pixel.
heightInchnumberRepresents the height of the shape, in unit of inches.
heightPtnumberRepresents the height of the shape, in unit of points.
heightCMnumberRepresents the height of the shape, in unit of centimeters.
leftnumberRepresents the horizontal offset of shape from its left column, in unit of pixels.
leftInchnumberRepresents the horizontal offset of shape from its left column, in unit of inches.
leftCMnumberRepresents the horizontal offset of shape from its left column, in unit of centimeters.
topnumberRepresents the vertical offset of shape from its top row, in unit of pixels.
topInchnumberRepresents the vertical offset of shape from its top row, in unit of inches.
topCMnumberRepresents the vertical offset of shape from its top row, in unit of centimeters.
topToCornernumberGets and sets the vertical offset of shape from worksheet top border, in unit of pixels.
leftToCornernumberGets and sets the horizonal offset of shape from worksheet left border.
xnumberGets and sets the horizontal offset of shape from worksheet left border,in unit of pixels.
ynumberGets and sets the vertical offset of shape from worksheet top border,in unit of pixels.
widthScalenumberGets and sets the width scale, in unit of percent of the original picture width. If the shape is not picture ,the WidthScale property only returns 100;
heightScalenumberGets and sets the height scale,in unit of percent of the original picture height. If the shape is not picture ,the HeightScale property only returns 100;
topInShapenumberRepresents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape.
leftInShapenumberRepresents the horizontal offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape.
widthInShapenumberRepresents the width of the shape, in unit of 1/4000 of the parent shape.
heightInShapenumberRepresents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape..
groupGroupShapeReadonly. Gets the group shape which contains this shape.
typeAutoShapeTypeReadonly. Gets the auto shape type.
hasLinebooleanGets and sets the line border of the shape is visible.
isFilledbooleanIndicates whether the fill format is visible.
isFlippedHorizontallybooleanGets and sets whether shape is horizontally flipped .
isFlippedVerticallybooleanGets and sets whether shape is vertically flipped .
actualLowerRightRownumberReadonly. Get the actual bottom row.
relativeToOriginalPictureSizebooleanIndicates whether shape is relative to original picture size.
linkedCellstringGets or sets the worksheet range linked to the control’s value.
inputRangestringGets or sets the worksheet range used to fill the specified combo box.
textShapeTypeAutoShapeTypeGets and sets the preset text shape type.
textBodyFontSettingCollectionReadonly. Gets and sets the setting of the shape’s text.
fontFontRepresents the font of shape.
textOptionsTextOptionsRepresents the text options of the shape.
textstringGets and sets the text of this shape.
isRichTextbooleanReadonly. Whether or not the text is rich text.
htmlTextstringGets and sets the html string which contains data and some formats in this textbox.
textVerticalOverflowTextOverflowTypeGets and sets the text vertical overflow type of the shape which contains text.
textHorizontalOverflowTextOverflowTypeGets and sets the text horizontal overflow type of the shape which contains text.
isTextWrappedbooleanGets and sets the text wrapped type of the shape which contains text.
textOrientationTypeTextOrientationTypeGets and sets the text orientation type of the shape.
textHorizontalAlignmentTextAlignmentTypeGets and sets the text horizontal alignment type of the shape.
textVerticalAlignmentTextAlignmentTypeGets and sets the text vertical alignment type of the shape.
textDirectionTextDirectionTypeGets/Sets the direction of the text flow for this object.
textBoxOptionsTextBoxOptionsReadonly. Gets the text information in the shape
controlDataUint8ArrayReadonly. Gets the data of control.
activeXControlActiveXControlReadonly. Gets the ActiveX control.
pathsShapePathCollectionReadonly. Gets the paths of a custom geometric shape.
geometryGeometryReadonly. Gets the geometry
isDecorativebooleanIndicates whether the object is decorative.

Methods

MethodDescription
getEquationParagraph(number)Get the specified math paragraph from the TextBody property of the TextBox object. Notice: (1) Returns NULL when the index is out of bounds or not found. (2) Also returns NULL if the specified index position is not a math paragraph.
getEquationParagraph()Gets the first math paragraph from the TextBody property of the TextBox object.
toFrontOrBack(number)Brings the shape to the front or sends the shape to back.
getLockedProperty(ShapeLockType)Gets the value of locked property.
setLockedProperty(ShapeLockType, boolean)Set the locked property.
addHyperlink(string)Adds a hyperlink to the shape.
removeHyperlink()Removes the hyperlink of the shape.
moveToRange(number, number, number, number)Moves the shape to a specified range.
alignTopRightCorner(number, number)Moves the picture to the top-right corner.
getConnectionPoints()Get the connection points
toImageAsync(ImageType)Creates the shape image and saves it to a stream in the specified format.
toImageAsync(string, ImageOrPrintOptions)Saves the shape to a file.
toImageAsync(ImageOrPrintOptions)Saves the shape to a stream.
toImage(ImageType)Creates the shape image and saves it to a stream in the specified format.
toImage(string, ImageOrPrintOptions)Saves the shape to a file.
toImage(ImageOrPrintOptions)Saves the shape to a stream.
getLinkedCell(boolean, boolean)Gets the range linked to the control’s value.
setLinkedCell(string, boolean, boolean)Sets the range linked to the control’s value.
getInputRange(boolean, boolean)Gets the range used to fill the control.
setInputRange(string, boolean, boolean)Sets the range used to fill the control.
updateSelectedValue()Update the selected value by the value of the linked cell.
calculateTextSize()Recalculate the text area
formatCharacters(number, number, Font, StyleFlag)Formats some characters with the font setting.
characters(number, number)Returns a Characters object that represents a range of characters within the text.
getRichFormattings()Returns all Characters objects that represents a range of characters within the text .
removeActiveXControl()Remove activeX control.
getActualBox()Get the actual position and size of the shape (after applying rotation, flip, etc.)
fitToTextSize()Recalculate a text area suitable for displaying all text content.
getResultOfSmartArt()Converting smart art to grouped shapes.
isSameSetting(VObject)Returns whether the shape is same.

constructor(Shape)

Constructs from a parent object convertible to this.

constructor(obj: Shape);

Parameters:

ParameterTypeDescription
objShapeThe parent object.

macroName

Gets and sets the name of macro.

macroName : string;

isEquation

Readonly. Indicates whether the shape only contains an equation.

isEquation : boolean;

isSmartArt

Readonly. Indicates whether the shape is a smart art.

isSmartArt : boolean;

Remarks

Only for ooxml file.

zOrderPosition

Returns the position of a shape in the z-order.

zOrderPosition : number;

name

Gets and sets the name of the shape.

name : string;

alternativeText

Returns or sets the descriptive (alternative) text string of the Shape object.

alternativeText : string;

title

Specifies the title (caption) of the current shape object.

title : string;

line

Readonly. Gets line style

line : LineFormat;

fill

Readonly. Returns a FillFormat object that contains fill formatting properties for the specified shape.

fill : FillFormat;

shadowEffect

Readonly. Represents a Drawing.ShadowEffect object that specifies shadow effect for the chart element or shape.

shadowEffect : ShadowEffect;

reflection

Readonly. Represents a ReflectionEffect object that specifies reflection effect for the chart element or shape.

reflection : ReflectionEffect;

glow

Readonly. Represents a GlowEffect object that specifies glow effect for the chart element or shape.

glow : GlowEffect;

softEdges

Gets and sets the radius of blur to apply to the edges, in unit of points.

softEdges : number;

threeDFormat

Readonly. Gets and sets 3d format of the shape.

threeDFormat : ThreeDFormat;

formatPicture

Readonly. Gets and sets the options of the picture format.

formatPicture : MsoFormatPicture;

isHidden

Indicates whether the object is visible.

isHidden : boolean;

isLockAspectRatio

True means that aspect ratio of the shape is locked.

isLockAspectRatio : boolean;

Remarks

Only for pictures and Ole Objects. NOTE: This member is now obsolete. Instead, please use Shape.IsAspectRatioLocked property. This property will be removed 12 months later since July 2024. Aspose apologizes for any inconvenience you may have experienced.

isAspectRatioLocked

True means that aspect ratio of the shape is locked.

isAspectRatioLocked : boolean;

Remarks

Only for pictures and Ole Objects.

rotationAngle

Gets and sets the rotation of the shape.

rotationAngle : number;

Readonly. Gets the hyperlink of the shape.

hyperlink : Hyperlink;

id

Readonly. Gets the identifier of this shape.

id : number;

spid

Readonly. Specifies an optional string identifier that an application can use to identify the particular shape.

spid : string;

spt

Readonly. Specifies an optional number that an application can use to associate the particular shape with a defined shape type.

spt : number;

worksheet

Readonly. Gets the Worksheet object which contains this shape.

worksheet : Worksheet;

isGroup

Readonly. Indicates whether this shape is a group shape.

isGroup : boolean;

isInGroup

Readonly. Indicates whether the shape is grouped.

isInGroup : boolean;

isWordArt

Readonly. Indicates whether this shape is a word art.

isWordArt : boolean;

Remarks

Only for the Legacy Shape of xls file.

textEffect

Readonly. Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Applies to Shape objects that represent WordArt.

textEffect : TextEffectFormat;

isLocked

True means the object can not be modified when the sheet is protected. Note that this value is meaningful only if the worksheet or objects in the worksheet are protected.

isLocked : boolean;

isPrintable

Indicates whether the object is printable. If False, this shape will not be printed when printing.

isPrintable : boolean;

msoDrawingType

Readonly. Gets drawing type.

msoDrawingType : MsoDrawingType;

autoShapeType

Gets and sets the auto shape type.

autoShapeType : AutoShapeType;

anchorType

Gets and set the type of the shape anchor placeholder.

anchorType : ShapeAnchorType;

placement

Represents the way the drawing object is attached to the cells below it. The property controls the placement of an object on a worksheet.

placement : PlacementType;

upperLeftRow

Represents the top row index.

upperLeftRow : number;

Remarks

If the shape is in the shape or in the group , UpperLeftRow will be ignored.

upperDeltaY

Gets or sets the shape’s vertical offset from its upper left corner row.

upperDeltaY : number;

Remarks

The range of value is 0 to 256.

upperLeftColumn

Represents upper left corner column index.

upperLeftColumn : number;

upperDeltaX

Gets or sets the shape’s horizontal offset from its upper left corner column.

upperDeltaX : number;

Remarks

The range of value is 0 to 1024.

lowerRightRow

Represents lower right corner row index.

lowerRightRow : number;

lowerDeltaY

Gets or sets the shape’s vertical offset from its lower right corner row.

lowerDeltaY : number;

Remarks

The range of value is 0 to 256.

lowerRightColumn

Represents lower right corner column index.

lowerRightColumn : number;

lowerDeltaX

Gets or sets the shape’s horizontal offset from its lower right corner column.

lowerDeltaX : number;

Remarks

The range of value is 0 to 1024.

right

Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.

right : number;

bottom

Represents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.

bottom : number;

width

Represents the width of shape, in unit of pixels.

width : number;

widthInch

Represents the width of the shape, in unit of inch.

widthInch : number;

widthPt

Represents the width of the shape, in unit of point.

widthPt : number;

widthCM

Represents the width of the shape, in unit of centimeters.

widthCM : number;

height

Represents the height of shape, in unit of pixel.

height : number;

heightInch

Represents the height of the shape, in unit of inches.

heightInch : number;

heightPt

Represents the height of the shape, in unit of points.

heightPt : number;

heightCM

Represents the height of the shape, in unit of centimeters.

heightCM : number;

left

Represents the horizontal offset of shape from its left column, in unit of pixels.

left : number;

leftInch

Represents the horizontal offset of shape from its left column, in unit of inches.

leftInch : number;

leftCM

Represents the horizontal offset of shape from its left column, in unit of centimeters.

leftCM : number;

top

Represents the vertical offset of shape from its top row, in unit of pixels.

top : number;

Remarks

If the shape is in the chart, represents the vertical offset of shape from its top border.

topInch

Represents the vertical offset of shape from its top row, in unit of inches.

topInch : number;

topCM

Represents the vertical offset of shape from its top row, in unit of centimeters.

topCM : number;

topToCorner

Gets and sets the vertical offset of shape from worksheet top border, in unit of pixels.

topToCorner : number;

leftToCorner

Gets and sets the horizonal offset of shape from worksheet left border.

leftToCorner : number;

x

Gets and sets the horizontal offset of shape from worksheet left border,in unit of pixels.

x : number;

y

Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels.

y : number;

widthScale

Gets and sets the width scale, in unit of percent of the original picture width. If the shape is not picture ,the WidthScale property only returns 100;

widthScale : number;

heightScale

Gets and sets the height scale,in unit of percent of the original picture height. If the shape is not picture ,the HeightScale property only returns 100;

heightScale : number;

topInShape

Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape.

topInShape : number;

Remarks

Only Applies when this shape in the group or chart.

leftInShape

Represents the horizontal offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape.

leftInShape : number;

Remarks

Only Applies when this shape in the group or chart.

widthInShape

Represents the width of the shape, in unit of 1/4000 of the parent shape.

widthInShape : number;

Remarks

Only Applies when this shape in the group or chart.

heightInShape

Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape..

heightInShape : number;

Remarks

Only Applies when this shape in the group or chart.

group

Readonly. Gets the group shape which contains this shape.

group : GroupShape;

type

Readonly. Gets the auto shape type.

type : AutoShapeType;

hasLine

Gets and sets the line border of the shape is visible.

hasLine : boolean;

isFilled

Indicates whether the fill format is visible.

isFilled : boolean;

isFlippedHorizontally

Gets and sets whether shape is horizontally flipped .

isFlippedHorizontally : boolean;

isFlippedVertically

Gets and sets whether shape is vertically flipped .

isFlippedVertically : boolean;

actualLowerRightRow

Readonly. Get the actual bottom row.

actualLowerRightRow : number;

relativeToOriginalPictureSize

Indicates whether shape is relative to original picture size.

relativeToOriginalPictureSize : boolean;

linkedCell

Gets or sets the worksheet range linked to the control’s value.

linkedCell : string;

inputRange

Gets or sets the worksheet range used to fill the specified combo box.

inputRange : string;

textShapeType

Gets and sets the preset text shape type.

textShapeType : AutoShapeType;

textBody

Readonly. Gets and sets the setting of the shape’s text.

textBody : FontSettingCollection;

font

Represents the font of shape.

font : Font;

textOptions

Represents the text options of the shape.

textOptions : TextOptions;

text

Gets and sets the text of this shape.

text : string;

isRichText

Readonly. Whether or not the text is rich text.

isRichText : boolean;

htmlText

Gets and sets the html string which contains data and some formats in this textbox.

htmlText : string;

textVerticalOverflow

Gets and sets the text vertical overflow type of the shape which contains text.

textVerticalOverflow : TextOverflowType;

textHorizontalOverflow

Gets and sets the text horizontal overflow type of the shape which contains text.

textHorizontalOverflow : TextOverflowType;

isTextWrapped

Gets and sets the text wrapped type of the shape which contains text.

isTextWrapped : boolean;

textOrientationType

Gets and sets the text orientation type of the shape.

textOrientationType : TextOrientationType;

textHorizontalAlignment

Gets and sets the text horizontal alignment type of the shape.

textHorizontalAlignment : TextAlignmentType;

textVerticalAlignment

Gets and sets the text vertical alignment type of the shape.

textVerticalAlignment : TextAlignmentType;

textDirection

Gets/Sets the direction of the text flow for this object.

textDirection : TextDirectionType;

textBoxOptions

Readonly. Gets the text information in the shape

textBoxOptions : TextBoxOptions;

controlData

Readonly. Gets the data of control.

controlData : Uint8Array;

activeXControl

Readonly. Gets the ActiveX control.

activeXControl : ActiveXControl;

paths

Readonly. Gets the paths of a custom geometric shape.

paths : ShapePathCollection;

geometry

Readonly. Gets the geometry

geometry : Geometry;

isDecorative

Indicates whether the object is decorative.

isDecorative : boolean;

getEquationParagraph(number)

Get the specified math paragraph from the TextBody property of the TextBox object. Notice: (1) Returns NULL when the index is out of bounds or not found. (2) Also returns NULL if the specified index position is not a math paragraph.

getEquationParagraph(index: number) : EquationNode;

Parameters:

ParameterTypeDescription
indexnumberThe position index of the math paragraph, starting from 0.

Returns

Returns the math paragraph specified by index.

getEquationParagraph()

Gets the first math paragraph from the TextBody property of the TextBox object.

getEquationParagraph() : EquationNode;

Returns

If there has math paragraph, returns the first one, otherwise returns null.

toFrontOrBack(number)

Brings the shape to the front or sends the shape to back.

toFrontOrBack(orders: number) : void;

Parameters:

ParameterTypeDescription
ordersnumberIf it’s less than zero, sets the shape to back. /// If it’s greater than zero, brings the shape to front.

getLockedProperty(ShapeLockType)

Gets the value of locked property.

getLockedProperty(type: ShapeLockType) : boolean;

Parameters:

ParameterTypeDescription
typeShapeLockTypeThe type of the shape locked property.

Returns

Returns the value of locked property.

setLockedProperty(ShapeLockType, boolean)

Set the locked property.

setLockedProperty(type: ShapeLockType, value: boolean) : void;

Parameters:

ParameterTypeDescription
typeShapeLockTypeThe locked type.
valuebooleanThe value of the property.

Adds a hyperlink to the shape.

addHyperlink(address: string) : Hyperlink;

Parameters:

ParameterTypeDescription
addressstringAddress of the hyperlink.

Returns

Return the new hyperlink object.

Removes the hyperlink of the shape.

removeHyperlink() : void;

moveToRange(number, number, number, number)

Moves the shape to a specified range.

moveToRange(upperLeftRow: number, upperLeftColumn: number, lowerRightRow: number, lowerRightColumn: number) : void;

Parameters:

ParameterTypeDescription
upperLeftRownumberUpper left row index.
upperLeftColumnnumberUpper left column index.
lowerRightRownumberLower right row index
lowerRightColumnnumberLower right column index

alignTopRightCorner(number, number)

Moves the picture to the top-right corner.

alignTopRightCorner(topRow: number, rightColumn: number) : void;

Parameters:

ParameterTypeDescription
topRownumberthe row index.
rightColumnnumberthe column index.

getConnectionPoints()

Get the connection points

getConnectionPoints() : number[][];

Returns

[X,Y] pairs of the connection point. Every item is a float[2] array, [0] represents x and [1] represents y.

toImageAsync(ImageType)

Creates the shape image and saves it to a stream in the specified format.

toImageAsync(imageType: ImageType) : Promise<Uint8Array>;

Parameters:

ParameterTypeDescription
imageTypeImageTypeThe type in which to save the image.

Returns

The result stream

Remarks

The following formats are supported: .bmp, .gif, .jpg, .jpeg, .tiff, .emf.

toImageAsync(string, ImageOrPrintOptions)

Saves the shape to a file.

toImageAsync(imageFile: string, options: ImageOrPrintOptions) : Promise<void>;

Parameters:

ParameterTypeDescription
imageFilestring
optionsImageOrPrintOptions

Returns

Promise

toImageAsync(ImageOrPrintOptions)

Saves the shape to a stream.

toImageAsync(options: ImageOrPrintOptions) : Promise<Uint8Array>;

Parameters:

ParameterTypeDescription
optionsImageOrPrintOptions

Returns

The result stream

toImage(ImageType)

Creates the shape image and saves it to a stream in the specified format.

toImage(imageType: ImageType) : Uint8Array;

Parameters:

ParameterTypeDescription
imageTypeImageTypeThe type in which to save the image.

Returns

The result stream

Remarks

The following formats are supported: .bmp, .gif, .jpg, .jpeg, .tiff, .emf.

toImage(string, ImageOrPrintOptions)

Saves the shape to a file.

toImage(imageFile: string, options: ImageOrPrintOptions) : void;

Parameters:

ParameterTypeDescription
imageFilestring
optionsImageOrPrintOptions

toImage(ImageOrPrintOptions)

Saves the shape to a stream.

toImage(options: ImageOrPrintOptions) : Uint8Array;

Parameters:

ParameterTypeDescription
optionsImageOrPrintOptions

Returns

The result stream

getLinkedCell(boolean, boolean)

Gets the range linked to the control’s value.

getLinkedCell(isR1C1: boolean, isLocal: boolean) : string;

Parameters:

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns

The range linked to the control’s value.

setLinkedCell(string, boolean, boolean)

Sets the range linked to the control’s value.

setLinkedCell(formula: string, isR1C1: boolean, isLocal: boolean) : void;

Parameters:

ParameterTypeDescription
formulastringThe range linked to the control’s value.
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

getInputRange(boolean, boolean)

Gets the range used to fill the control.

getInputRange(isR1C1: boolean, isLocal: boolean) : string;

Parameters:

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns

The range used to fill the control.

setInputRange(string, boolean, boolean)

Sets the range used to fill the control.

setInputRange(formula: string, isR1C1: boolean, isLocal: boolean) : void;

Parameters:

ParameterTypeDescription
formulastringThe range used to fill the control.
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

updateSelectedValue()

Update the selected value by the value of the linked cell.

updateSelectedValue() : void;

calculateTextSize()

Recalculate the text area

calculateTextSize() : number[];

Returns

Text’s Size in an array(width and height).

formatCharacters(number, number, Font, StyleFlag)

Formats some characters with the font setting.

formatCharacters(startIndex: number, length: number, font: Font, flag: StyleFlag) : void;

Parameters:

ParameterTypeDescription
startIndexnumberThe start index.
lengthnumberThe length.
fontFontThe font setting.
flagStyleFlagThe flag of the font setting.

characters(number, number)

Returns a Characters object that represents a range of characters within the text.

characters(startIndex: number, length: number) : FontSetting;

Parameters:

ParameterTypeDescription
startIndexnumberThe index of the start of the character.
lengthnumberThe number of characters.

Returns

Characters object.

Remarks

This method only works on shape with title.

getRichFormattings()

Returns all Characters objects that represents a range of characters within the text .

getRichFormattings() : FontSetting[];

Returns

All Characters objects

removeActiveXControl()

Remove activeX control.

removeActiveXControl() : void;

getActualBox()

Get the actual position and size of the shape (after applying rotation, flip, etc.)

getActualBox() : number[];

Returns

Return the position and size in the order of x, y, w, h

Remarks

Note:The interface is not fully functional, especially the location information is not correct.It is recommended not to use this interface until the function is complete.

fitToTextSize()

Recalculate a text area suitable for displaying all text content.

fitToTextSize() : void;

getResultOfSmartArt()

Converting smart art to grouped shapes.

getResultOfSmartArt() : GroupShape;

Returns

GroupShape

isSameSetting(VObject)

Returns whether the shape is same.

isSameSetting(obj: VObject) : boolean;

Parameters:

ParameterTypeDescription
objVObject