Shape

Inheritance: java.lang.Object

public class Shape

Represents the msodrawing object.

Example

         //Initialize a new workbook.
         Workbook book = new Workbook();
 
         //Add a shape.(e.g rectangle)
         Shape shape = book.getWorksheets().get(0).getShapes().addRectangle(2, 0, 2, 0, 130, 130);
 
         //do your business
 
         //Save the excel file.
         book.save("exmaple.xlsx");

Methods

MethodDescription
addHyperlink(String address)Adds a hyperlink to the shape.
alignTopRightCorner(int topRow, int rightColumn)Moves the picture to the top-right corner.
calculateTextSize()Recalculate the text area
characters(int startIndex, int length)Returns a Characters object that represents a range of characters within the text.
equals(Object arg0)
formatCharacters(int startIndex, int length, Font font, StyleFlag flag)Formats some characters with the font setting.
getActiveXControl()Gets the ActiveX control.
getActualBox()Get the actual position and size of the shape (after applying rotation, flip, etc.)
getActualLowerRightRow()Get the actual bottom row.
getAlternativeText()Returns or sets the descriptive (alternative) text string of the Shape object.
getAnchorType()Gets the type of the shape anchor placeholder.
getAutoShapeType()Gets the auto shape type.
getBottom()Represents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.
getCharacters()Returns all Characters objects that represents a range of characters within the text .
getClass()
getConnectionPoints()Get the connection points
getControlData()Gets the data of control.
getCreateId()Gets create id for this shape.
getFill()Returns a Area.getFillFormat() object that contains fill formatting properties for the specified shape.
getFillFormat()Returns a MsoFillFormat object that contains fill formatting properties for the specified shape.
getFont()Represents the font of shape.
getFormatPicture()Gets the options of the picture format.
getGeometry()Gets the geometry
getGlow()Represents a ShapePropertyCollection.getGlowEffect() object that specifies glow effect for the chart element or shape.
getGroup()Gets the group shape which contains this shape.
getHeight()Represents the height of shape, in unit of pixel.
getHeightCM()Represents the height of the shape, in unit of centimeters.
getHeightInShape()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..
getHeightInch()Represents the height of the shape, in unit of inches.
getHeightPt()Represents the height of the shape, in unit of points.
getHeightScale()Gets the height scale,in unit of percent of the original picture height.
getHtmlText()Gets the html string which contains data and some formats in this textbox.
getHyperlink()Gets the hyperlink of the shape.
getId()Gets the identifier of this shape.
getInputRange()Gets the worksheet range used to fill the specified combo box.
getInputRange(boolean isR1C1, boolean isLocal)Gets the range used to fill the control.
getLeft()Represents the horizontal offset of shape from its left column, in unit of pixels.
getLeftCM()Represents the horizontal offset of shape from its left column, in unit of centimeters.
getLeftInShape()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.
getLeftInch()Represents the horizontal offset of shape from its left column, in unit of inches.
getLeftToCorner()Gets the horizonal offset of shape from worksheet left border.
getLine()Gets line style
getLineFormat()Returns a MsoLineFormat object that contains line formatting properties for the specified shape.
getLinkedCell()Gets the worksheet range linked to the control’s value.
getLinkedCell(boolean isR1C1, boolean isLocal)Gets the range linked to the control’s value.
getLockedProperty(int type)Gets the value of locked property.
getLowerDeltaX()Gets the shape’s horizontal offset from its lower right corner column.
getLowerDeltaY()Gets the shape’s vertical offset from its lower right corner row.
getLowerRightColumn()Represents lower right corner column index.
getLowerRightRow()Represents lower right corner row index.
getMacroName()Gets the name of macro.
getMsoDrawingType()Gets drawing type.
getName()Gets the name of the shape.
getPaths()Gets the paths of a custom geometric shape.
getPlacement()Represents the way the drawing object is attached to the cells below it.
getReflection()Represents a ReflectionEffect object that specifies reflection effect for the chart element or shape.
getRelativeToOriginalPictureSize()Indicates whether shape is relative to original picture size.
getResultOfSmartArt()Converting smart art to grouped shapes.
getRichFormattings()Returns all Characters objects that represents a range of characters within the text .
getRight()Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
getRotationAngle()Gets the rotation of the shape.
getShadowEffect()Represents a ShadowEffect object that specifies shadow effect for the chart element or shape.
getSoftEdges()Gets the radius of blur to apply to the edges, in unit of points.
getSpid()Specifies an optional string identifier that an application can use to identify the particular shape.
getSpt()Specifies an optional number that an application can use to associate the particular shape with a defined shape type.
getText()Gets the text of this shape.
getTextBody()Gets the setting of the shape’s text.
getTextDirection()Gets the direction of the text flow for this object.
getTextEffect()Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape.
getTextHorizontalAlignment()Gets the text horizontal alignment type of the shape.
getTextHorizontalOverflow()Gets the text horizontal overflow type of the shape which contains text.
getTextOptions()Represents the text options of the shape.
getTextOrientationType()Gets the text orientation type of the shape.
getTextShapeType()Gets the preset text shape type.
getTextVerticalAlignment()Gets the text vertical alignment type of the shape.
getTextVerticalOverflow()Gets the text vertical overflow type of the shape which contains text.
getThreeDFormat()Gets 3d format of the shape.
getTitle()Specifies the title (caption) of the current shape object.
getTop()Represents the vertical offset of shape from its top row, in unit of pixels.
getTopCM()Represents the vertical offset of shape from its top row, in unit of centimeters.
getTopInShape()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.
getTopInch()Represents the vertical offset of shape from its top row, in unit of inches.
getTopToCorner()Gets the vertical offset of shape from worksheet top border, in unit of pixels.
getType()Gets the auto shape type.
getUpperDeltaX()Gets the shape’s horizontal offset from its upper left corner column.
getUpperDeltaY()Gets the shape’s vertical offset from its upper left corner row.
getUpperLeftColumn()Represents upper left corner column index.
getUpperLeftRow()Represents the top row index.
getWidth()Represents the width of shape, in unit of pixels.
getWidthCM()Represents the width of the shape, in unit of centimeters.
getWidthInShape()Represents the width of the shape, in unit of 1/4000 of the parent shape.
getWidthInch()Represents the width of the shape, in unit of inch.
getWidthPt()Represents the width of the shape, in unit of point.
getWidthScale()Gets the width scale, in unit of percent of the original picture width.
getWorksheet()Gets the Range.getWorksheet() object which contains this shape.
getX()Gets the horizontal offset of shape from worksheet left border,in unit of pixels.
getY()Gets the vertical offset of shape from worksheet top border,in unit of pixels.
getZOrderPosition()Returns the position of a shape in the z-order.
hasLine()Gets the line border of the shape is visible.
hashCode()
isAspectRatioLocked()True means that aspect ratio of the shape is locked.
isDecorative()Indicates whether the object is decorative.
isEquation()Indicates whether the shape only contains an equation.
isFilled()Indicates whether the fill format is visible.
isFlippedHorizontally()Gets whether shape is horizontally flipped .
isFlippedVertically()Gets whether shape is vertically flipped .
isGroup()Indicates whether this shape is a group shape.
isHidden()Indicates whether the object is visible.
isInGroup()Indicates whether the shape is grouped.
isLockAspectRatio()True means that aspect ratio of the shape is locked.
isLocked()True means the object can not be modified when the sheet is protected.
isPrintable()Indicates whether the object is printable.
isRichText()Whether or not the text is rich text.
isSameSetting(Object obj)Returns whether the shape is same.
isSmartArt()Indicates whether the shape is a smart art.
isTextWrapped()Gets the text wrapped type of the shape which contains text.
isWordArt()Indicates whether this shape is a word art.
moveToRange(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)Moves the shape to a specified range.
notify()
notifyAll()
removeActiveXControl()Remove activeX control.
removeHyperlink()Removes the hyperlink of the shape.
setAlternativeText(String value)Returns or sets the descriptive (alternative) text string of the Shape object.
setAnchorType(int value)Sets the type of the shape anchor placeholder.
setAspectRatioLocked(boolean value)True means that aspect ratio of the shape is locked.
setAutoShapeType(int value)Sets the auto shape type.
setBottom(int value)Represents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.
setCreateId(UUID value)Sets create id for this shape.
setDecorative(boolean value)Indicates whether the object is decorative.
setFilled(boolean value)Indicates whether the fill format is visible.
setFlippedHorizontally(boolean value)Sets whether shape is horizontally flipped .
setFlippedVertically(boolean value)Sets whether shape is vertically flipped .
setFont(Font value)Represents the font of shape.
setHasLine(boolean value)Sets the line border of the shape is visible.
setHeight(int value)Represents the height of shape, in unit of pixel.
setHeightCM(double value)Represents the height of the shape, in unit of centimeters.
setHeightInShape(int value)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..
setHeightInch(double value)Represents the height of the shape, in unit of inches.
setHeightPt(double value)Represents the height of the shape, in unit of points.
setHeightScale(int value)Sets the height scale,in unit of percent of the original picture height.
setHidden(boolean value)Indicates whether the object is visible.
setHtmlText(String value)Sets the html string which contains data and some formats in this textbox.
setInputRange(String value)Sets the worksheet range used to fill the specified combo box.
setInputRange(String formula, boolean isR1C1, boolean isLocal)Sets the range used to fill the control.
setLeft(int value)Represents the horizontal offset of shape from its left column, in unit of pixels.
setLeftCM(double value)Represents the horizontal offset of shape from its left column, in unit of centimeters.
setLeftInShape(int value)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.
setLeftInch(double value)Represents the horizontal offset of shape from its left column, in unit of inches.
setLeftToCorner(int value)Sets the horizonal offset of shape from worksheet left border.
setLinkedCell(String value)Sets the worksheet range linked to the control’s value.
setLinkedCell(String formula, boolean isR1C1, boolean isLocal)Sets the range linked to the control’s value.
setLockAspectRatio(boolean value)True means that aspect ratio of the shape is locked.
setLocked(boolean value)True means the object can not be modified when the sheet is protected.
setLockedProperty(int type, boolean value)Set the locked property.
setLowerDeltaX(int value)Sets the shape’s horizontal offset from its lower right corner column.
setLowerDeltaY(int value)Sets the shape’s vertical offset from its lower right corner row.
setLowerRightColumn(int value)Represents lower right corner column index.
setLowerRightRow(int value)Represents lower right corner row index.
setMacroName(String value)Sets the name of macro.
setName(String value)Sets the name of the shape.
setPlacement(int value)Represents the way the drawing object is attached to the cells below it.
setPrintable(boolean value)Indicates whether the object is printable.
setRelativeToOriginalPictureSize(boolean value)Indicates whether shape is relative to original picture size.
setRight(int value)Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
setRotationAngle(double value)Sets the rotation of the shape.
setSoftEdges(double value)Sets the radius of blur to apply to the edges, in unit of points.
setText(String value)Sets the text of this shape.
setTextDirection(int value)Sets the direction of the text flow for this object.
setTextHorizontalAlignment(int value)Sets the text horizontal alignment type of the shape.
setTextHorizontalOverflow(int value)Sets the text horizontal overflow type of the shape which contains text.
setTextOptions(TextOptions value)Represents the text options of the shape.
setTextOrientationType(int value)Sets the text orientation type of the shape.
setTextShapeType(int value)Sets the preset text shape type.
setTextVerticalAlignment(int value)Sets the text vertical alignment type of the shape.
setTextVerticalOverflow(int value)Sets the text vertical overflow type of the shape which contains text.
setTextWrapped(boolean value)Sets the text wrapped type of the shape which contains text.
setTitle(String value)Specifies the title (caption) of the current shape object.
setTop(int value)Represents the vertical offset of shape from its top row, in unit of pixels.
setTopCM(double value)Represents the vertical offset of shape from its top row, in unit of centimeters.
setTopInShape(int value)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.
setTopInch(double value)Represents the vertical offset of shape from its top row, in unit of inches.
setTopToCorner(int value)Sets the vertical offset of shape from worksheet top border, in unit of pixels.
setUpperDeltaX(int value)Sets the shape’s horizontal offset from its upper left corner column.
setUpperDeltaY(int value)Sets the shape’s vertical offset from its upper left corner row.
setUpperLeftColumn(int value)Represents upper left corner column index.
setUpperLeftRow(int value)Represents the top row index.
setWidth(int value)Represents the width of shape, in unit of pixels.
setWidthCM(double value)Represents the width of the shape, in unit of centimeters.
setWidthInShape(int value)Represents the width of the shape, in unit of 1/4000 of the parent shape.
setWidthInch(double value)Represents the width of the shape, in unit of inch.
setWidthPt(double value)Represents the width of the shape, in unit of point.
setWidthScale(int value)Sets the width scale, in unit of percent of the original picture width.
setX(int value)Sets the horizontal offset of shape from worksheet left border,in unit of pixels.
setY(int value)Sets the vertical offset of shape from worksheet top border,in unit of pixels.
setZOrderPosition(int value)Returns the position of a shape in the z-order.
toFrontOrBack(int orders)Brings the shape to the front or sends the shape to back.
toImage(OutputStream stream, ImageFormat imageFormat)Creates the shape image and saves it to a stream in the specified format.
toImage(OutputStream stream, ImageOrPrintOptions options)Saves the shape to a stream.
toImage(String imageFile, ImageOrPrintOptions options)Saves the shape to a file.
toString()
updateSelectedValue()Update the selected value by the value of the linked cell.
wait()
wait(long arg0)
wait(long arg0, int arg1)
public Hyperlink addHyperlink(String address)

Adds a hyperlink to the shape.

Example

         Hyperlink hyperlink = shape.addHyperlink("https://www.aspose.com/");

Parameters:

ParameterTypeDescription
addressjava.lang.StringAddress of the hyperlink.

Returns: Hyperlink - Return the new hyperlink object.

alignTopRightCorner(int topRow, int rightColumn)

public void alignTopRightCorner(int topRow, int rightColumn)

Moves the picture to the top-right corner.

Example

         shape.alignTopRightCorner(2, 5);

Parameters:

ParameterTypeDescription
topRowintthe row index.
rightColumnintthe column index.

calculateTextSize()

public int[] calculateTextSize()

Recalculate the text area

Example

         //The size of the text area is:w=size[0],h=size[1]
         int[] size = shape.calculateTextSize();

Returns: int[] - Text’s Size in an array(width and height).

characters(int startIndex, int length)

public FontSetting characters(int startIndex, int length)

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

Remarks

This method only works on shape with title.

Example

         FontSetting fontSetting = shape.characters(0, 4);

Parameters:

ParameterTypeDescription
startIndexintThe index of the start of the character.
lengthintThe number of characters.

Returns: FontSetting - Characters object.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

formatCharacters(int startIndex, int length, Font font, StyleFlag flag)

public void formatCharacters(int startIndex, int length, Font font, StyleFlag flag)

Formats some characters with the font setting.

Parameters:

ParameterTypeDescription
startIndexintThe start index.
lengthintThe length.
fontFontThe font setting.
flagStyleFlagThe flag of the font setting.

getActiveXControl()

public ActiveXControl getActiveXControl()

Gets the ActiveX control.

Example

         if(shape.getActiveXControl() != null)
         {
             CheckBoxActiveXControl checkBox1 = (CheckBoxActiveXControl)shape.getActiveXControl();
             //The font name of CheckBox
             String fontName = checkBox1.getFont().getName();
         }

Returns: ActiveXControl

getActualBox()

public float[] getActualBox()

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

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.

Returns: float[] - Return the position and size in the order of x, y, w, h

getActualLowerRightRow()

public int getActualLowerRightRow()

Get the actual bottom row.

Example

         int rRow = shape.getActualLowerRightRow();

Returns: int

getAlternativeText()

public String getAlternativeText()

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

Example

         shape.setAlternativeText("a rectangle");

Returns: java.lang.String

getAnchorType()

public int getAnchorType()

Gets the type of the shape anchor placeholder.

See ShapeAnchorType.

Example

         if (shape.getAnchorType() == ShapeAnchorType.ONE_CELL_ANCHOR)
             shape.setAnchorType(ShapeAnchorType.TWO_CELL_ANCHOR);

Returns: int

getAutoShapeType()

public int getAutoShapeType()

Gets the auto shape type.

See AutoShapeType.

Example

         if (shape.getAutoShapeType() == com.aspose.cells.AutoShapeType.UNKNOWN)
             shape.setAutoShapeType(com.aspose.cells.AutoShapeType.RECTANGLE);

Returns: int

getBottom()

public int getBottom()

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

Example

         if (shape.getBottom() == 3)
             shape.setBottom(1);

Returns: int

getCharacters()

public ArrayList getCharacters()

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

Remarks

NOTE: This method is now obsolete. Instead, please use Shape.GetRichFormattings() method. This method will be removed 12 months later since November 2023. Aspose apologizes for any inconvenience you may have experienced.

Example

         FontSetting fontSetting = shape.characters(0, 4);

Returns: java.util.ArrayList - All Characters objects

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getConnectionPoints()

public float[][] getConnectionPoints()

Get the connection points

Example

         float[][] points = shape.getConnectionPoints();

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

getControlData()

public byte[] getControlData()

Gets the data of control.

Example

         if(shape.getControlData() == null)
             System.out.println("No data.");

Returns: byte[]

getCreateId()

public UUID getCreateId()

Gets create id for this shape.

Returns: java.util.UUID

getFill()

public FillFormat getFill()

Returns a Area.getFillFormat() object that contains fill formatting properties for the specified shape.

Example

         FillFormat fillFmt = shape.getFill();

Returns: FillFormat

getFillFormat()

public MsoFillFormat getFillFormat()

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

Remarks

NOTE: This member is now obsolete. Instead, please use Shape.Fill property. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.

Returns: MsoFillFormat

getFont()

public Font getFont()

Represents the font of shape.

Example

         Font font = shape.getFont();
         font.setName("Arial");
         font.setSize(12);
         font.setColor(Color.getRed());

Returns: Font

getFormatPicture()

public MsoFormatPicture getFormatPicture()

Gets the options of the picture format.

Example

         MsoFormatPicture msoFormatPicture = shape.getFormatPicture();

Returns: MsoFormatPicture

getGeometry()

public Geometry getGeometry()

Gets the geometry

Example

         if (shape.getGeometry() != null &&shape.getGeometry().getShapeAdjustValues().getCount() == 0)
             System.out.println("No geometry path.");

Returns: Geometry

getGlow()

public GlowEffect getGlow()

Represents a ShapePropertyCollection.getGlowEffect() object that specifies glow effect for the chart element or shape.

Example

         GlowEffect glowEffect = shape.getGlow();

Returns: GlowEffect

getGroup()

public GroupShape getGroup()

Gets the group shape which contains this shape.

Example

         GroupShape groupShape = shape.getGroup();

Returns: GroupShape

getHeight()

public int getHeight()

Represents the height of shape, in unit of pixel.

Example

         if (shape.getHeight() == 3)
             shape.setHeight(1);

Returns: int

getHeightCM()

public double getHeightCM()

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

Example

         if (shape.getHeightCM() == 3)
             shape.setHeightCM(1);

Returns: double

getHeightInShape()

public int getHeightInShape()

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..

Remarks

Only Applies when this shape in the group or chart.

Example

         if (shape.isInGroup() &&shape.getHeightInShape() == 4000)
             shape.setHeightInShape(2000);

Returns: int

getHeightInch()

public double getHeightInch()

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

Example

         if (shape.getHeightInch() == 3)
             shape.setHeightInch(1);

Returns: double

getHeightPt()

public double getHeightPt()

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

Example

         if (shape.getHeightPt() == 3)
             shape.setHeightPt(1);

Returns: double

getHeightScale()

public int getHeightScale()

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

Example

         if (shape.getHeightScale() == 3)
             shape.setHeightScale(1);

Returns: int

getHtmlText()

public String getHtmlText()

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

Example

         String html = shape.getHtmlText();
         if(html == null || "".equals(html))
         {
             shape.setHtmlText("<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>This is a <b>test</b>.</Font>");
         }

Returns: java.lang.String

public Hyperlink getHyperlink()

Gets the hyperlink of the shape.

Example

         Hyperlink hyperlink = shape.getHyperlink();

Returns: Hyperlink

getId()

public int getId()

Gets the identifier of this shape.

Example

         int id = shape.getId();

Returns: int

getInputRange()

public String getInputRange()

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

Example

         if (shape.getInputRange().equals("$B$6:$B10"))
             shape.setInputRange("$A$1:$A$5");

Returns: java.lang.String

getInputRange(boolean isR1C1, boolean isLocal)

public String getInputRange(boolean isR1C1, boolean isLocal)

Gets the range used to fill the control.

Example

         String range = shape.getInputRange(false, true);
         //If successful, a value like "$A$1:$A$3" will be returned

Parameters:

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

Returns: java.lang.String - The range used to fill the control.

getLeft()

public int getLeft()

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

Example

         if (shape.getLeft() == 3)
             shape.setLeft(1);

Returns: int

getLeftCM()

public double getLeftCM()

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

Example

         if (shape.getLeftCM() == 3)
             shape.setLeftCM(1);

Returns: double

getLeftInShape()

public int getLeftInShape()

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.

Remarks

Only Applies when this shape in the group or chart.

Example

         if (shape.isInGroup() &&shape.getLeftInShape() == 2000)
             shape.setLeftInShape(4000);

Returns: int

getLeftInch()

public double getLeftInch()

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

Example

         if (shape.getLeftInch() == 3)
             shape.setLeftInch(1);

Returns: double

getLeftToCorner()

public int getLeftToCorner()

Gets the horizonal offset of shape from worksheet left border.

Example

         if (shape.getLeftToCorner() == 3)
             shape.setLeftToCorner(1);

Returns: int

getLine()

public LineFormat getLine()

Gets line style

Example

         LineFormat lineFmt = shape.getLine();

Returns: LineFormat

getLineFormat()

public MsoLineFormat getLineFormat()

Returns a MsoLineFormat object that contains line formatting properties for the specified shape.

Remarks

NOTE: This member is now obsolete. Instead, please use Shape.Line property. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.

Returns: MsoLineFormat

getLinkedCell()

public String getLinkedCell()

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

Example

         if (shape.getLinkedCell().equals("$B$6"))
             shape.setLinkedCell("A1");

Returns: java.lang.String

getLinkedCell(boolean isR1C1, boolean isLocal)

public String getLinkedCell(boolean isR1C1, boolean isLocal)

Gets the range linked to the control’s value.

Example

         //You may get results like '$A$1'
         String link = shape.getLinkedCell(false, false);

Parameters:

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

Returns: java.lang.String - The range linked to the control’s value.

getLockedProperty(int type)

public boolean getLockedProperty(int type)

Gets the value of locked property.

Example

         int noAdjustHandles = 0;
         if (shape.getLockedProperty(ShapeLockType.ADJUST_HANDLES))
             noAdjustHandles = 1;

Parameters:

ParameterTypeDescription
typeintShapeLockType. The type of the shape locked property.

Returns: boolean - Returns the value of locked property.

getLowerDeltaX()

public int getLowerDeltaX()

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

Remarks

The range of value is 0 to 1024.

Example

         if (shape.getLowerDeltaX() == 3)
             shape.setLowerDeltaX(1);

Returns: int

getLowerDeltaY()

public int getLowerDeltaY()

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

Remarks

The range of value is 0 to 256.

Example

         if (shape.getLowerDeltaY() == 3)
             shape.setLowerDeltaY(1);

Returns: int

getLowerRightColumn()

public int getLowerRightColumn()

Represents lower right corner column index.

Example

         if (shape.getLowerRightColumn() == 3)
             shape.setLowerRightColumn(1);

Returns: int

getLowerRightRow()

public int getLowerRightRow()

Represents lower right corner row index.

Example

         if (shape.getLowerRightRow() == 3)
             shape.setLowerRightRow(1);

Returns: int

getMacroName()

public String getMacroName()

Gets the name of macro.

Example

         //Sets the name of macro.
         shape.setMacroName("DoWork()");

Returns: java.lang.String

getMsoDrawingType()

public int getMsoDrawingType()

Gets drawing type.

See MsoDrawingType.

Example

         /*Aspose.Cells.Drawing.MsoDrawingType*/int msoDrawingType = shape.getMsoDrawingType();

Returns: int

getName()

public String getName()

Gets the name of the shape.

Example

         shape.setName("shape1");

Returns: java.lang.String

getPaths()

public ShapePathCollection getPaths()

Gets the paths of a custom geometric shape.

Example

         //Returns non-null if there is a path to the custom geometry
         if(shape.getPaths() == null)
             System.out.println("No custom geometry path.");

Returns: ShapePathCollection

getPlacement()

public int getPlacement()

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

See PlacementType.

Example

         if (shape.getPlacement() == PlacementType.MOVE)
             shape.setPlacement(PlacementType.MOVE_AND_SIZE);

Returns: int

getReflection()

public ReflectionEffect getReflection()

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

Example

         ReflectionEffect reflectionEffect = shape.getReflection();

Returns: ReflectionEffect

getRelativeToOriginalPictureSize()

public boolean getRelativeToOriginalPictureSize()

Indicates whether shape is relative to original picture size.

Example

         if(shape.getRelativeToOriginalPictureSize())
             shape.setRelativeToOriginalPictureSize(false);

Returns: boolean

getResultOfSmartArt()

public GroupShape getResultOfSmartArt()

Converting smart art to grouped shapes.

Example

         if(shape.isSmartArt())
         {
             GroupShape groupShape = shape.getResultOfSmartArt();
         }

Returns: GroupShape

getRichFormattings()

public FontSetting[] getRichFormattings()

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

Example

         FontSetting[] list = shape.getRichFormattings();

Returns: com.aspose.cells.FontSetting[] - All Characters objects

getRight()

public int getRight()

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

Example

         if (shape.getRight() == 3)
             shape.setRight(1);

Returns: int

getRotationAngle()

public double getRotationAngle()

Gets the rotation of the shape.

Example

         //Gets rotation angle of the shape.
         double angle = shape.getRotationAngle() ;
 
         //Gets rotation angle of the shape.
          shape.setRotationAngle(60);

Returns: double

getShadowEffect()

public ShadowEffect getShadowEffect()

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

Example

         ShadowEffect shadowEffect = shape.getShadowEffect();

Returns: ShadowEffect

getSoftEdges()

public double getSoftEdges()

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

Example

         shape.setSoftEdges(0.5d);

Returns: double

getSpid()

public String getSpid()

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

Example

         String spid = shape.getSpid();

Returns: java.lang.String

getSpt()

public int getSpt()

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

Example

         int spt = shape.getSpt();

Returns: int

getText()

public String getText()

Gets the text of this shape.

Example

         if(shape.getText() == null)
             shape.setText("This is a test.");

Returns: java.lang.String

getTextBody()

public FontSettingCollection getTextBody()

Gets the setting of the shape’s text.

Example

         FontSettingCollection fontSettingCollection = shape.getTextBody();
         fontSettingCollection.setText("This is a test.");

Returns: FontSettingCollection

getTextDirection()

public int getTextDirection()

Gets the direction of the text flow for this object.

See TextDirectionType.

Example

         if (shape.getTextDirection() == com.aspose.cells.TextDirectionType.CONTEXT)
             shape.setTextDirection(com.aspose.cells.TextDirectionType.LEFT_TO_RIGHT);

Returns: int

getTextEffect()

public TextEffectFormat getTextEffect()

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

Example

         if(shape.isWordArt())
         {
             TextEffectFormat textEffectFormat = shape.getTextEffect();
         }

Returns: TextEffectFormat

getTextHorizontalAlignment()

public int getTextHorizontalAlignment()

Gets the text horizontal alignment type of the shape.

See TextAlignmentType.

Example

         if (shape.getTextHorizontalAlignment() == com.aspose.cells.TextAlignmentType.BOTTOM)
             shape.setTextHorizontalAlignment(com.aspose.cells.TextAlignmentType.CENTER);

Returns: int

getTextHorizontalOverflow()

public int getTextHorizontalOverflow()

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

See TextOverflowType.

Example

         if (shape.getTextHorizontalOverflow() == com.aspose.cells.TextOverflowType.CLIP)
             shape.setTextHorizontalOverflow(com.aspose.cells.TextOverflowType.OVERFLOW);

Returns: int

getTextOptions()

public TextOptions getTextOptions()

Represents the text options of the shape.

Example

         TextOptions opt = shape.getTextOptions();
         opt.setColor(Color.getBlue());
         opt.setSize(8);

Returns: TextOptions

getTextOrientationType()

public int getTextOrientationType()

Gets the text orientation type of the shape.

See TextOrientationType.

Example

         if (shape.getTextOrientationType() == com.aspose.cells.TextOrientationType.NO_ROTATION)
             shape.setTextOrientationType(com.aspose.cells.TextOrientationType.TOP_TO_BOTTOM);

Returns: int

getTextShapeType()

public int getTextShapeType()

Gets the preset text shape type.

See AutoShapeType.

Example

         if (shape.getTextShapeType() == com.aspose.cells.AutoShapeType.UNKNOWN)
             shape.setTextShapeType(com.aspose.cells.AutoShapeType.RECTANGLE);

Returns: int

getTextVerticalAlignment()

public int getTextVerticalAlignment()

Gets the text vertical alignment type of the shape.

See TextAlignmentType.

Example

         if (shape.getTextVerticalAlignment() == com.aspose.cells.TextAlignmentType.BOTTOM)
             shape.setTextVerticalAlignment(com.aspose.cells.TextAlignmentType.CENTER);

Returns: int

getTextVerticalOverflow()

public int getTextVerticalOverflow()

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

See TextOverflowType.

Example

         if (shape.getTextVerticalOverflow() == com.aspose.cells.TextOverflowType.CLIP)
             shape.setTextVerticalOverflow(com.aspose.cells.TextOverflowType.OVERFLOW);

Returns: int

getThreeDFormat()

public ThreeDFormat getThreeDFormat()

Gets 3d format of the shape.

Example

         ThreeDFormat threeDFormat = shape.getThreeDFormat();

Returns: ThreeDFormat

getTitle()

public String getTitle()

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

Example

         shape.setTitle("title1");

Returns: java.lang.String

getTop()

public int getTop()

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

Remarks

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

Example

         if (shape.getTop() == 3)
             shape.setTop(1);

Returns: int

getTopCM()

public double getTopCM()

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

Example

         if (shape.getTopCM() == 3)
             shape.setTopCM(1);

Returns: double

getTopInShape()

public int getTopInShape()

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.

Remarks

Only Applies when this shape in the group or chart.

Example

         if (shape.isInGroup() &&shape.getTopInShape() == 8000)
             shape.setTopInShape(4000);

Returns: int

getTopInch()

public double getTopInch()

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

Example

         if (shape.getTopInch() == 3)
             shape.setTopInch(1);

Returns: double

getTopToCorner()

public int getTopToCorner()

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

Example

         if (shape.getTopToCorner() == 3)
             shape.setTopToCorner(1);

Returns: int

getType()

public int getType()

Gets the auto shape type.

See AutoShapeType.

Example

         /*Aspose.Cells.Drawing.AutoShapeType*/int autoShapeType = shape.getType();

Returns: int

getUpperDeltaX()

public int getUpperDeltaX()

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

Remarks

The range of value is 0 to 1024.

Example

         if (shape.getUpperDeltaX() == 3)
             shape.setUpperDeltaX(1);

Returns: int

getUpperDeltaY()

public int getUpperDeltaY()

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

Remarks

The range of value is 0 to 256.

Example

         if (shape.getUpperDeltaY() == 3)
             shape.setUpperDeltaY(1);

Returns: int

getUpperLeftColumn()

public int getUpperLeftColumn()

Represents upper left corner column index.

Example

         if (shape.getUpperLeftColumn() == 3)
             shape.setUpperLeftColumn(1);

Returns: int

getUpperLeftRow()

public int getUpperLeftRow()

Represents the top row index.

Remarks

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

Example

         if (shape.getUpperLeftRow() == 3)
             shape.setUpperLeftRow(1);

Returns: int

getWidth()

public int getWidth()

Represents the width of shape, in unit of pixels.

Example

         if (shape.getWidth() == 3)
             shape.setWidth(1);

Returns: int

getWidthCM()

public double getWidthCM()

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

Example

         if (shape.getWidthCM() == 3)
             shape.setWidthCM(1);

Returns: double

getWidthInShape()

public int getWidthInShape()

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

Remarks

Only Applies when this shape in the group or chart.

Example

         if (shape.isInGroup() &&shape.getWidthInShape() == 2000)
             shape.setWidthInShape(4000);

Returns: int

getWidthInch()

public double getWidthInch()

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

Example

         if (shape.getWidthInch() == 3)
             shape.setWidthInch(1);

Returns: double

getWidthPt()

public double getWidthPt()

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

Example

         if (shape.getWidthPt() == 3)
             shape.setWidthPt(1);

Returns: double

getWidthScale()

public int getWidthScale()

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

Example

         if (shape.getWidthScale() == 3)
             shape.setWidthScale(1);

Returns: int

getWorksheet()

public Worksheet getWorksheet()

Gets the Range.getWorksheet() object which contains this shape.

Example

         Worksheet worksheet = shape.getWorksheet();

Returns: Worksheet

getX()

public int getX()

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

Example

         if (shape.getX() == 3)
             shape.setX(1);

Returns: int

getY()

public int getY()

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

Example

         if (shape.getY() == 3)
             shape.setY(1);

Returns: int

getZOrderPosition()

public int getZOrderPosition()

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

Example

         shape.setZOrderPosition(3);

Returns: int

hasLine()

public boolean hasLine()

Gets the line border of the shape is visible.

Example

         if(shape.hasLine() == false)
             shape.setHasLine(true);

Returns: boolean

hashCode()

public native int hashCode()

Returns: int

isAspectRatioLocked()

public boolean isAspectRatioLocked()

True means that aspect ratio of the shape is locked.

Remarks

Only for pictures and Ole Objects.

Example

         shape.setAspectRatioLocked(false);

Returns: boolean

isDecorative()

public boolean isDecorative()

Indicates whether the object is decorative.

Returns: boolean

isEquation()

public boolean isEquation()

Indicates whether the shape only contains an equation.

Example

         //If true,the shape only contains an equation.
         if(shape.isEquation())
         {
             //The shape contains only an equation
         }

Returns: boolean

isFilled()

public boolean isFilled()

Indicates whether the fill format is visible.

Example

         if(shape.isFilled() == false)
             shape.setFilled(true);

Returns: boolean

isFlippedHorizontally()

public boolean isFlippedHorizontally()

Gets whether shape is horizontally flipped .

Example

         if(shape.isFlippedHorizontally() == false)
             shape.setFlippedHorizontally(true);

Returns: boolean

isFlippedVertically()

public boolean isFlippedVertically()

Gets whether shape is vertically flipped .

Example

         if(shape.isFlippedVertically() == false)
             shape.setFlippedVertically(true);

Returns: boolean

isGroup()

public boolean isGroup()

Indicates whether this shape is a group shape.

Example

         if(shape.isGroup())
         {
             //This shape is a group.
         }

Returns: boolean

isHidden()

public boolean isHidden()

Indicates whether the object is visible.

Example

         shape.setHidden(false);

Returns: boolean

isInGroup()

public boolean isInGroup()

Indicates whether the shape is grouped.

Returns: boolean

isLockAspectRatio()

public boolean isLockAspectRatio()

True means that aspect ratio of the shape is locked.

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.

Example

         shape.setHidden(false);

Returns: boolean

isLocked()

public boolean 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.

Example

         //Sets the specified shape to unlocked state
         if (shape.getWorksheet().isProtected() &&shape.isLocked())
         {
             shape.setLocked(false);
         }
 
         //Sets the specified shape to a locked state
         if (shape.getWorksheet().isProtected() &&!shape.isLocked())
         {
             shape.setLocked(true);
         }

Returns: boolean

isPrintable()

public boolean isPrintable()

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

Example

         if(shape.isPrintable())
             shape.setPrintable(false);

Returns: boolean

isRichText()

public boolean isRichText()

Whether or not the text is rich text.

Example

         if(shape.isRichText())
             System.out.println("The text is rich text.");

Returns: boolean

isSameSetting(Object obj)

public boolean isSameSetting(Object obj)

Returns whether the shape is same.

Example

         if (shape.isSameSetting(shape))
             System.out.println("Two objects the same.");

Parameters:

ParameterTypeDescription
objjava.lang.Object

Returns: boolean -

isSmartArt()

public boolean isSmartArt()

Indicates whether the shape is a smart art.

Remarks

Only for ooxml file.

Example

         //if true,the shape is a smart art.
         if(shape.isSmartArt())
         {
             //The shape is SmartArt object.
         }

Returns: boolean

isTextWrapped()

public boolean isTextWrapped()

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

Example

         if (shape.isTextWrapped())
             shape.setTextWrapped(!shape.isTextWrapped());

Returns: boolean

isWordArt()

public boolean isWordArt()

Indicates whether this shape is a word art.

Remarks

Only for the Legacy Shape of xls file.

Example

         if(shape.isWordArt())
         {
             //This shape is a WordArt object.
         }

Returns: boolean

moveToRange(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)

public void moveToRange(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)

Moves the shape to a specified range.

Example

         shape.moveToRange(12, 3, 13, 5);

Parameters:

ParameterTypeDescription
upperLeftRowintUpper left row index.
upperLeftColumnintUpper left column index.
lowerRightRowintLower right row index
lowerRightColumnintLower right column index

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

removeActiveXControl()

public void removeActiveXControl()

Remove activeX control.

Example

         if(shape.getActiveXControl() != null)
         {
             shape.removeActiveXControl();
         }
public void removeHyperlink()

Removes the hyperlink of the shape.

Example

         shape.removeHyperlink();

setAlternativeText(String value)

public void setAlternativeText(String value)

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

Parameters:

ParameterTypeDescription
valuejava.lang.String

setAnchorType(int value)

public void setAnchorType(int value)

Sets the type of the shape anchor placeholder.

See ShapeAnchorType.

Parameters:

ParameterTypeDescription
valueint

setAspectRatioLocked(boolean value)

public void setAspectRatioLocked(boolean value)

True means that aspect ratio of the shape is locked.

Remarks

Only for pictures and Ole Objects.

Parameters:

ParameterTypeDescription
valueboolean

setAutoShapeType(int value)

public void setAutoShapeType(int value)

Sets the auto shape type.

See AutoShapeType.

Parameters:

ParameterTypeDescription
valueint

setBottom(int value)

public void setBottom(int value)

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

Parameters:

ParameterTypeDescription
valueint

setCreateId(UUID value)

public void setCreateId(UUID value)

Sets create id for this shape.

Parameters:

ParameterTypeDescription
valuejava.util.UUID

setDecorative(boolean value)

public void setDecorative(boolean value)

Indicates whether the object is decorative.

Parameters:

ParameterTypeDescription
valueboolean

setFilled(boolean value)

public void setFilled(boolean value)

Indicates whether the fill format is visible.

Parameters:

ParameterTypeDescription
valueboolean

setFlippedHorizontally(boolean value)

public void setFlippedHorizontally(boolean value)

Sets whether shape is horizontally flipped .

Parameters:

ParameterTypeDescription
valueboolean

setFlippedVertically(boolean value)

public void setFlippedVertically(boolean value)

Sets whether shape is vertically flipped .

Parameters:

ParameterTypeDescription
valueboolean

setFont(Font value)

public void setFont(Font value)

Represents the font of shape.

Parameters:

ParameterTypeDescription
valueFont

setHasLine(boolean value)

public void setHasLine(boolean value)

Sets the line border of the shape is visible.

Parameters:

ParameterTypeDescription
valueboolean

setHeight(int value)

public void setHeight(int value)

Represents the height of shape, in unit of pixel.

Parameters:

ParameterTypeDescription
valueint

setHeightCM(double value)

public void setHeightCM(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setHeightInShape(int value)

public void setHeightInShape(int value)

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..

Remarks

Only Applies when this shape in the group or chart.

Parameters:

ParameterTypeDescription
valueint

setHeightInch(double value)

public void setHeightInch(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setHeightPt(double value)

public void setHeightPt(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setHeightScale(int value)

public void setHeightScale(int value)

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;

Parameters:

ParameterTypeDescription
valueint

setHidden(boolean value)

public void setHidden(boolean value)

Indicates whether the object is visible.

Parameters:

ParameterTypeDescription
valueboolean

setHtmlText(String value)

public void setHtmlText(String value)

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

Parameters:

ParameterTypeDescription
valuejava.lang.String

setInputRange(String value)

public void setInputRange(String value)

Sets the worksheet range used to fill the specified combo box.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setInputRange(String formula, boolean isR1C1, boolean isLocal)

public void setInputRange(String formula, boolean isR1C1, boolean isLocal)

Sets the range used to fill the control.

Example

         //After executing the code below, a ListBox object is created in the generated file. When the selected option is clicked, the selected value is displayed in cell A12.
 
         for (int i = 0; i? ++i)
         {
             Cell cell = book.getWorksheets().get(0).getCells().get(i, 0);
             cell.setValue(i + 1);
         }
 
         //Create a ListBox object
 
         //ActiveX Controls
         //Aspose.Cells.Drawing.Shape listBox = book.Worksheets[0].Shapes.AddActiveXControl( Aspose.Cells.Drawing.ActiveXControls.ControlType.ListBox,2, 0, 2, 0, 130, 130);
 
         //Form Controls
         Shape listBox = book.getWorksheets().get(0).getShapes().addListBox(2, 0, 2, 0, 130, 130);
 
         //Sets the range used to fill the control.
         listBox.setInputRange("$A$1:$A$6", false, false);
 
         //Sets the range linked to the control's value.
         listBox.setLinkedCell("$A$12", false, true);

Parameters:

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

setLeft(int value)

public void setLeft(int value)

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

Parameters:

ParameterTypeDescription
valueint

setLeftCM(double value)

public void setLeftCM(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setLeftInShape(int value)

public void setLeftInShape(int value)

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.

Remarks

Only Applies when this shape in the group or chart.

Parameters:

ParameterTypeDescription
valueint

setLeftInch(double value)

public void setLeftInch(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setLeftToCorner(int value)

public void setLeftToCorner(int value)

Sets the horizonal offset of shape from worksheet left border.

Parameters:

ParameterTypeDescription
valueint

setLinkedCell(String value)

public void setLinkedCell(String value)

Sets the worksheet range linked to the control’s value.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setLinkedCell(String formula, boolean isR1C1, boolean isLocal)

public void setLinkedCell(String formula, boolean isR1C1, boolean isLocal)

Sets the range linked to the control’s value.

Example

         //After executing the code below, a ScrollBar object is created in the generated file. As you drag the slider, the value is displayed in cell A12.
 
         //ActiveX Controls
         //Aspose.Cells.Drawing.Shape scrollBar = book.Worksheets[0].Shapes.AddActiveXControl( Aspose.Cells.Drawing.ActiveXControls.ControlType.ScrollBar,2, 0, 2, 0, 30, 130);
 
         //Form Controls
         Shape scrollBar = book.getWorksheets().get(0).getShapes().addScrollBar(2, 0, 2, 0, 130, 30);
 
         //Sets the range linked to the control's value.
         scrollBar.setLinkedCell("$A$12", false, true);

Parameters:

ParameterTypeDescription
formulajava.lang.StringThe 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.

setLockAspectRatio(boolean value)

public void setLockAspectRatio(boolean value)

True means that aspect ratio of the shape is locked.

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.

Parameters:

ParameterTypeDescription
valueboolean

setLocked(boolean value)

public void setLocked(boolean value)

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.

Parameters:

ParameterTypeDescription
valueboolean

setLockedProperty(int type, boolean value)

public void setLockedProperty(int type, boolean value)

Set the locked property.

Example

         shape.setLockedProperty(ShapeLockType.ADJUST_HANDLES, true);

Parameters:

ParameterTypeDescription
typeintShapeLockType. The locked type.
valuebooleanThe value of the property.

setLowerDeltaX(int value)

public void setLowerDeltaX(int value)

Sets the shape’s horizontal offset from its lower right corner column.

Remarks

The range of value is 0 to 1024.

Parameters:

ParameterTypeDescription
valueint

setLowerDeltaY(int value)

public void setLowerDeltaY(int value)

Sets the shape’s vertical offset from its lower right corner row.

Remarks

The range of value is 0 to 256.

Parameters:

ParameterTypeDescription
valueint

setLowerRightColumn(int value)

public void setLowerRightColumn(int value)

Represents lower right corner column index.

Parameters:

ParameterTypeDescription
valueint

setLowerRightRow(int value)

public void setLowerRightRow(int value)

Represents lower right corner row index.

Parameters:

ParameterTypeDescription
valueint

setMacroName(String value)

public void setMacroName(String value)

Sets the name of macro.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setName(String value)

public void setName(String value)

Sets the name of the shape.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setPlacement(int value)

public void setPlacement(int value)

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

See PlacementType.

Parameters:

ParameterTypeDescription
valueint

setPrintable(boolean value)

public void setPrintable(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setRelativeToOriginalPictureSize(boolean value)

public void setRelativeToOriginalPictureSize(boolean value)

Indicates whether shape is relative to original picture size.

Parameters:

ParameterTypeDescription
valueboolean

setRight(int value)

public void setRight(int value)

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

Parameters:

ParameterTypeDescription
valueint

setRotationAngle(double value)

public void setRotationAngle(double value)

Sets the rotation of the shape.

Parameters:

ParameterTypeDescription
valuedouble

setSoftEdges(double value)

public void setSoftEdges(double value)

Sets the radius of blur to apply to the edges, in unit of points.

Parameters:

ParameterTypeDescription
valuedouble

setText(String value)

public void setText(String value)

Sets the text of this shape.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setTextDirection(int value)

public void setTextDirection(int value)

Sets the direction of the text flow for this object.

See TextDirectionType.

Parameters:

ParameterTypeDescription
valueint

setTextHorizontalAlignment(int value)

public void setTextHorizontalAlignment(int value)

Sets the text horizontal alignment type of the shape.

See TextAlignmentType.

Parameters:

ParameterTypeDescription
valueint

setTextHorizontalOverflow(int value)

public void setTextHorizontalOverflow(int value)

Sets the text horizontal overflow type of the shape which contains text.

See TextOverflowType.

Parameters:

ParameterTypeDescription
valueint

setTextOptions(TextOptions value)

public void setTextOptions(TextOptions value)

Represents the text options of the shape.

Parameters:

ParameterTypeDescription
valueTextOptions

setTextOrientationType(int value)

public void setTextOrientationType(int value)

Sets the text orientation type of the shape.

See TextOrientationType.

Parameters:

ParameterTypeDescription
valueint

setTextShapeType(int value)

public void setTextShapeType(int value)

Sets the preset text shape type.

See AutoShapeType.

Parameters:

ParameterTypeDescription
valueint

setTextVerticalAlignment(int value)

public void setTextVerticalAlignment(int value)

Sets the text vertical alignment type of the shape.

See TextAlignmentType.

Parameters:

ParameterTypeDescription
valueint

setTextVerticalOverflow(int value)

public void setTextVerticalOverflow(int value)

Sets the text vertical overflow type of the shape which contains text.

See TextOverflowType.

Parameters:

ParameterTypeDescription
valueint

setTextWrapped(boolean value)

public void setTextWrapped(boolean value)

Sets the text wrapped type of the shape which contains text.

Parameters:

ParameterTypeDescription
valueboolean

setTitle(String value)

public void setTitle(String value)

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

Parameters:

ParameterTypeDescription
valuejava.lang.String

setTop(int value)

public void setTop(int value)

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

Remarks

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

Parameters:

ParameterTypeDescription
valueint

setTopCM(double value)

public void setTopCM(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setTopInShape(int value)

public void setTopInShape(int value)

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.

Remarks

Only Applies when this shape in the group or chart.

Parameters:

ParameterTypeDescription
valueint

setTopInch(double value)

public void setTopInch(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setTopToCorner(int value)

public void setTopToCorner(int value)

Sets the vertical offset of shape from worksheet top border, in unit of pixels.

Parameters:

ParameterTypeDescription
valueint

setUpperDeltaX(int value)

public void setUpperDeltaX(int value)

Sets the shape’s horizontal offset from its upper left corner column.

Remarks

The range of value is 0 to 1024.

Parameters:

ParameterTypeDescription
valueint

setUpperDeltaY(int value)

public void setUpperDeltaY(int value)

Sets the shape’s vertical offset from its upper left corner row.

Remarks

The range of value is 0 to 256.

Parameters:

ParameterTypeDescription
valueint

setUpperLeftColumn(int value)

public void setUpperLeftColumn(int value)

Represents upper left corner column index.

Parameters:

ParameterTypeDescription
valueint

setUpperLeftRow(int value)

public void setUpperLeftRow(int value)

Represents the top row index.

Remarks

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

Parameters:

ParameterTypeDescription
valueint

setWidth(int value)

public void setWidth(int value)

Represents the width of shape, in unit of pixels.

Parameters:

ParameterTypeDescription
valueint

setWidthCM(double value)

public void setWidthCM(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setWidthInShape(int value)

public void setWidthInShape(int value)

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

Remarks

Only Applies when this shape in the group or chart.

Parameters:

ParameterTypeDescription
valueint

setWidthInch(double value)

public void setWidthInch(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setWidthPt(double value)

public void setWidthPt(double value)

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

Parameters:

ParameterTypeDescription
valuedouble

setWidthScale(int value)

public void setWidthScale(int value)

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;

Parameters:

ParameterTypeDescription
valueint

setX(int value)

public void setX(int value)

Sets the horizontal offset of shape from worksheet left border,in unit of pixels.

Parameters:

ParameterTypeDescription
valueint

setY(int value)

public void setY(int value)

Sets the vertical offset of shape from worksheet top border,in unit of pixels.

Parameters:

ParameterTypeDescription
valueint

setZOrderPosition(int value)

public void setZOrderPosition(int value)

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

Parameters:

ParameterTypeDescription
valueint

toFrontOrBack(int orders)

public void toFrontOrBack(int orders)

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

Example

         shape.toFrontOrBack(2);
         //or shape.ToFrontOrBack(-1);

Parameters:

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

toImage(OutputStream stream, ImageFormat imageFormat)

public void toImage(OutputStream stream, ImageFormat imageFormat)

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

Remarks

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

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe output stream.
imageFormatImageFormatThe format in which to save the image.

toImage(OutputStream stream, ImageOrPrintOptions options)

public void toImage(OutputStream stream, ImageOrPrintOptions options)

Saves the shape to a stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStream
optionsImageOrPrintOptions

toImage(String imageFile, ImageOrPrintOptions options)

public void toImage(String imageFile, ImageOrPrintOptions options)

Saves the shape to a file.

Example

         ImageOrPrintOptions op = new ImageOrPrintOptions();
         shape.toImage("exmaple.png", op);

Parameters:

ParameterTypeDescription
imageFilejava.lang.String
optionsImageOrPrintOptions

toString()

public String toString()

Returns: java.lang.String

updateSelectedValue()

public void updateSelectedValue()

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

Example

         Cell cell = null;
         for (int i = 0; i? ++i)
         {
             cell = book.getWorksheets().get(0).getCells().get(i, 0);
             cell.setValue(i + 1);
         }
 
         //Create a ListBox object
 
         //ActiveX Controls
         //Aspose.Cells.Drawing.Shape listBox = book.Worksheets[0].Shapes.AddActiveXControl( Aspose.Cells.Drawing.ActiveXControls.ControlType.ListBox,2, 0, 2, 0, 130, 130);
 
         //Form Controls
         Shape listBox = book.getWorksheets().get(0).getShapes().addListBox(2, 0, 2, 0, 130, 130);
 
         //Sets the range used to fill the control.
         listBox.setInputRange("$A$1:$A$6", false, false);
 
         //Sets the range linked to the control's value.
         listBox.setLinkedCell("$A$12", false, true);
 
         ListBox listbx = (ListBox)listBox;
 
         //Set the value of cell A12
         cell = book.getWorksheets().get(0).getCells().get(11, 0);
         cell.setValue(3);
 
         //Update the selected value by the value of the linked cell.
         listBox.updateSelectedValue();
 
         //-1 default, no option selected
         if(listbx.isSelected(2))
         {
             //Option 3 of the ListBox is selected
         }
 
         //Change the value of a linked cell
         cell.setValue(4);
 
         //Update the selected value by the value of the linked cell.
         listBox.updateSelectedValue();
         if(listbx.isSelected(3))
         {
             //Option 4 of the ListBox is selected
         }

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int