Shape
Inheritance: java.lang.Object
public class Shape
Represents the msodrawing object.
//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
Method | Description |
---|---|
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) | Formats some characters with the font setting. |
formatCharacters(int startIndex, int length, Font font, StyleFlag flag) | Formats some characters with the font setting. |
getActiveXControl() | Gets the ActiveX control. |
getActualLowerRightRow() | Get the actual bottom row. |
getAlternativeText() | Returns or sets the descriptive (alternative) text string of the Shape object. |
getAnchorType() | Gets 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. |
getFormat() | Represents the setting of the shape’s formatting. |
getFormatPicture() | Gets the options of the picture format. |
getGeometry() | Gets the geometry |
getGlow() | Represents a ShapeFormat.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. |
getHeightInChart() | 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.. |
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. |
getLeftInChart() | Represents the vertical offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape. |
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 mso 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. |
getPositionX() | Gets the horizonal offset of shape from worksheet left border,in unit of pixels. |
getPositionY() | Gets the vertical offset of shape from worksheet top border,in unit of pixels. |
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. |
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 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() | Represents the string in this TextBox object. |
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. |
getTextFrame() | Returns a TextFrame object that contains the alignment and anchoring 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. |
getTopInChart() | 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. |
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 upper left corner row index. |
getWidth() | Represents the width of shape, in unit of pixels. |
getWidthCM() | Represents the width of the shape, in unit of centimeters. |
getWidthInChart() | Represents the width of the shape, in unit of 1/4000 of the parent shape. |
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() | |
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 the shape is a group. |
isHidden() | Indicates whether the object is visible. |
isInGroup() | Indicates whether the shape is grouped. |
isLockAspectRatio() | True means that don’t allow changes in aspect ratio. |
isLocked() | True if the object is locked, False if the object can be modified when the sheet is protected. |
isPrintable() | True if 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 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() | Remove 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 shape anchor placeholder. |
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. |
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. |
setHeightInChart(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.. |
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. |
setLeftInChart(int value) | Represents the vertical offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape. |
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 don’t allow changes in aspect ratio. |
setLocked(boolean value) | True if the object is locked, False if the object can 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. |
setPositionX(int value) | Sets the horizonal offset of shape from worksheet left border,in unit of pixels. |
setPositionY(int value) | Sets the vertical offset of shape from worksheet top border,in unit of pixels. |
setPrintable(boolean value) | True if 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) | Represents the string in this TextBox object. |
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. |
setTopInChart(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. |
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 upper left corner 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. |
setWidthInChart(int value) | Represents the width of the shape, in unit of 1/4000 of the parent shape. |
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) |
addHyperlink(String address)
public Hyperlink addHyperlink(String address)
Adds a hyperlink to the shape.
Hyperlink hyperlink = shape.addHyperlink("https://www.aspose.com/");
Parameters:
Parameter | Type | Description |
---|---|---|
address | java.lang.String | Address 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.
shape.alignTopRightCorner(2, 5);
Parameters:
Parameter | Type | Description |
---|---|---|
topRow | int | the row index. |
rightColumn | int | the column index. |
calculateTextSize()
public int[] calculateTextSize()
Recalculate the text area
//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. This method only works on shape with title.
FontSetting fontSetting = shape.characters(0, 4);
Parameters:
Parameter | Type | Description |
---|---|---|
startIndex | int | The index of the start of the character. |
length | int | The number of characters. |
Returns: FontSetting - Characters object.
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
formatCharacters(int startIndex, int length, Font font)
public void formatCharacters(int startIndex, int length, Font font)
Formats some characters with the font setting. NOTE: This member is now obsolete. Instead, please use Shape.FormatCharacters(int startIndex, int length, Font font, StyleFlag flag) method. This property will be removed 12 months later since March 2016. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
startIndex | int | The start index. |
length | int | The length. |
font | Font | The font setting. |
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:
Parameter | Type | Description |
---|---|---|
startIndex | int | The start index. |
length | int | The length. |
font | Font | The font setting. |
flag | StyleFlag | The flag of the font setting. |
getActiveXControl()
public ActiveXControl getActiveXControl()
Gets the ActiveX control.
CheckBoxActiveXControl checkBox1 = (CheckBoxActiveXControl)shape.getActiveXControl();
//The font name of CheckBox
String fontName = checkBox1.getFont().getName();
Returns: ActiveXControl
getActualLowerRightRow()
public int getActualLowerRightRow()
Get the actual bottom row.
int rRow = shape.getActualLowerRightRow();
Returns: int
getAlternativeText()
public String getAlternativeText()
Returns or sets the descriptive (alternative) text string of the Shape object.
shape.setAlternativeText("a rectangle");
Returns: java.lang.String
getAnchorType()
public int getAnchorType()
Gets the shape anchor placeholder.
if (shape.getAnchorType() == ShapeAnchorType.ONE_CELL_ANCHOR)
shape.setAnchorType(ShapeAnchorType.TWO_CELL_ANCHOR);
Returns: int
getAutoShapeType()
public int getAutoShapeType()
Gets the auto shape type.
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.
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 .
ArrayList list = shape.getCharacters();
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
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.
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.
FillFormat fillFmt = shape.getFill();
Returns: FillFormat
getFillFormat()
public MsoFillFormat getFillFormat()
Returns a MsoFillFormat object that contains fill formatting properties for the specified shape. 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.
Font font = shape.getFont();
font.setName("Arial");
font.setSize(12);
font.setColor(Color.getRed());
Returns: Font
getFormat()
public ShapeFormat getFormat()
Represents the setting of the shape’s formatting. NOTE: This member is now obsolete. Instead, please use Shape.Fill and Shape.Line properties. This property will be removed 6 months later since August 2016. Aspose apologizes for any inconvenience you may have experienced.
Returns: ShapeFormat
getFormatPicture()
public MsoFormatPicture getFormatPicture()
Gets the options of the picture format.
MsoFormatPicture msoFormatPicture = shape.getFormatPicture();
Returns: MsoFormatPicture
getGeometry()
public Geometry getGeometry()
Gets the geometry
if (shape.getGeometry().getShapeAdjustValues().getCount() == 0)
System.out.println("No geometry path.");
Returns: Geometry
getGlow()
public GlowEffect getGlow()
Represents a ShapeFormat.getGlowEffect() object that specifies glow effect for the chart element or shape.
GlowEffect glowEffect = shape.getGlow();
Returns: GlowEffect
getGroup()
public GroupShape getGroup()
Gets the group shape which contains this shape.
GroupShape groupShape = shape.getGroup();
Returns: GroupShape
getHeight()
public int getHeight()
Represents the height of shape, in unit of pixel.
if (shape.getHeight() == 3)
shape.setHeight(1);
Returns: int
getHeightCM()
public double getHeightCM()
Represents the height of the shape, in unit of centimeters.
if (shape.getHeightCM() == 3)
shape.setHeightCM(1);
Returns: double
getHeightInChart()
public int getHeightInChart()
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.. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.HeightInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: int
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.. Only Applies when this shape in the group or chart.
if (shape.getUpperDeltaY() == 4000)
shape.setUpperDeltaY(2000);
Returns: int
getHeightInch()
public double getHeightInch()
Represents the height of the shape, in unit of inches.
if (shape.getHeightInch() == 3)
shape.setHeightInch(1);
Returns: double
getHeightPt()
public double getHeightPt()
Represents the height of the shape, in unit of points.
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;
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.
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
getHyperlink()
public Hyperlink getHyperlink()
Gets the hyperlink of the shape.
Hyperlink hyperlink = shape.getHyperlink();
Returns: Hyperlink
getId()
public int getId()
Gets the identifier of this shape.
int id = shape.getId();
Returns: int
getInputRange()
public String getInputRange()
Gets the worksheet range used to fill the specified combo box.
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.
String range = shape.getInputRange(false, true);
//If successful, a value like "$A$1:$A$3" will be returned
Parameters:
Parameter | Type | Description |
---|---|---|
isR1C1 | boolean | Whether the formula needs to be formatted as R1C1. |
isLocal | boolean | Whether 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.
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.
if (shape.getLeftCM() == 3)
shape.setLeftCM(1);
Returns: double
getLeftInChart()
public int getLeftInChart()
Represents the vertical offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.LeftInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: int
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. Only Applies when this shape in the group or chart.
if (shape.getUpperDeltaY() == 2000)
shape.setUpperDeltaY(4000);
Returns: int
getLeftInch()
public double getLeftInch()
Represents the horizontal offset of shape from its left column, in unit of inches.
if (shape.getLeftInch() == 3)
shape.setLeftInch(1);
Returns: double
getLeftToCorner()
public int getLeftToCorner()
Gets the horizonal offset of shape from worksheet left border.
if (shape.getLeftToCorner() == 3)
shape.setLeftToCorner(1);
Returns: int
getLine()
public LineFormat getLine()
Gets line style
LineFormat lineFmt = shape.getLine();
Returns: LineFormat
getLineFormat()
public MsoLineFormat getLineFormat()
Returns a MsoLineFormat object that contains line formatting properties for the specified shape. 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.
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.
//You may get results like '$A$1'
String link = shape.getLinkedCell(false, false);
Parameters:
Parameter | Type | Description |
---|---|---|
isR1C1 | boolean | Whether the formula needs to be formatted as R1C1. |
isLocal | boolean | Whether 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.
int noAdjustHandles = 0;
if (shape.getLockedProperty(ShapeLockType.ADJUST_HANDLES))
noAdjustHandles = 1;
Parameters:
Parameter | Type | Description |
---|---|---|
type | int | 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. The range of value is 0 to 1024.
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. The range of value is 0 to 256.
if (shape.getLowerDeltaY() == 3)
shape.setLowerDeltaY(1);
Returns: int
getLowerRightColumn()
public int getLowerRightColumn()
Represents lower right corner column index.
if (shape.getLowerRightColumn() == 3)
shape.setLowerRightColumn(1);
Returns: int
getLowerRightRow()
public int getLowerRightRow()
Represents lower right corner row index.
if (shape.getLowerRightRow() == 3)
shape.setLowerRightRow(1);
Returns: int
getMacroName()
public String getMacroName()
Gets the name of macro.
//Sets the name of macro.
shape.setMacroName("DoWork()");
Returns: java.lang.String
getMsoDrawingType()
public int getMsoDrawingType()
Gets mso drawing type.
/*Aspose.Cells.Drawing.MsoDrawingType*/int msoDrawingType = shape.getMsoDrawingType();
Returns: int
getName()
public String getName()
Gets the name of the shape.
shape.setName("shape1");
Returns: java.lang.String
getPaths()
public ShapePathCollection getPaths()
Gets the paths of a custom geometric shape.
//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.
if (shape.getPlacement() == PlacementType.MOVE)
shape.setPlacement(PlacementType.MOVE_AND_SIZE);
Returns: int
getPositionX()
public int getPositionX()
Gets the horizonal offset of shape from worksheet left border,in unit of pixels. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.X property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: int
getPositionY()
public int getPositionY()
Gets the vertical offset of shape from worksheet top border,in unit of pixels. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.Y property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: int
getReflection()
public ReflectionEffect getReflection()
Represents a ReflectionEffect object that specifies reflection effect for the chart element or shape.
ReflectionEffect reflectionEffect = shape.getReflection();
Returns: ReflectionEffect
getRelativeToOriginalPictureSize()
public boolean getRelativeToOriginalPictureSize()
Indicates whether shape is relative to original picture size.
if(shape.getRelativeToOriginalPictureSize())
shape.setRelativeToOriginalPictureSize(false);
Returns: boolean
getResultOfSmartArt()
public GroupShape getResultOfSmartArt()
Converting smart art to grouped shapes.
GroupShape groupShape = shape.getResultOfSmartArt();
Returns: GroupShape
getRight()
public int getRight()
Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
if (shape.getRight() == 3)
shape.setRight(1);
Returns: int
getRotationAngle()
public double getRotationAngle()
Gets the rotation of the shape.
if(shape.getRotationAngle() == 45)
shape.setRotationAngle(60);
Returns: double
getShadowEffect()
public ShadowEffect getShadowEffect()
Represents a ShadowEffect object that specifies shadow effect for the chart element or shape.
ShadowEffect shadowEffect = shape.getShadowEffect();
Returns: ShadowEffect
getSoftEdges()
public double getSoftEdges()
Gets the radius of blur to apply to the edges, in unit of points.
shape.setSoftEdges(0.5d);
Returns: double
getSpid()
public String getSpid()
Specifies an optional string that an application can use to Identify the particular shape.
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.
int spt = shape.getSpt();
Returns: int
getText()
public String getText()
Represents the string in this TextBox object.
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.
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.
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.
TextEffectFormat textEffectFormat = shape.getTextEffect();
Returns: TextEffectFormat
getTextFrame()
public MsoTextFrame getTextFrame()
Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. NOTE: This member is now obsolete. Instead, please use Shape.TextBody.TextAlignment property. This property will be removed 12 months later since May 2016. Aspose apologizes for any inconvenience you may have experienced.
Returns: MsoTextFrame
getTextHorizontalAlignment()
public int getTextHorizontalAlignment()
Gets the text horizontal alignment type of the shape.
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.
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.
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.
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.
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.
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.
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.
ThreeDFormat threeDFormat = shape.getThreeDFormat();
Returns: ThreeDFormat
getTitle()
public String getTitle()
Specifies the title (caption) of the current shape object.
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. If the shape is in the chart, represents the vertical offset of shape from its top border.
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.
if (shape.getTopCM() == 3)
shape.setTopCM(1);
Returns: double
getTopInChart()
public int getTopInChart()
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. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.TopInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: int
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. Only Applies when this shape in the group or chart.
if (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.
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.
if (shape.getTopToCorner() == 3)
shape.setTopToCorner(1);
Returns: int
getType()
public int getType()
Gets the auto shape type.
/*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. The range of value is 0 to 1024.
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. The range of value is 0 to 256.
if (shape.getUpperDeltaY() == 3)
shape.setUpperDeltaY(1);
Returns: int
getUpperLeftColumn()
public int getUpperLeftColumn()
Represents upper left corner column index.
if (shape.getUpperLeftColumn() == 3)
shape.setUpperLeftColumn(1);
Returns: int
getUpperLeftRow()
public int getUpperLeftRow()
Represents upper left corner row index. If the shape is in the shape or in the group , UpperLeftRow will be ignored.
if (shape.getUpperLeftRow() == 3)
shape.setUpperLeftRow(1);
Returns: int
getWidth()
public int getWidth()
Represents the width of shape, in unit of pixels.
if (shape.getWidth() == 3)
shape.setWidth(1);
Returns: int
getWidthCM()
public double getWidthCM()
Represents the width of the shape, in unit of centimeters.
if (shape.getWidthCM() == 3)
shape.setWidthCM(1);
Returns: double
getWidthInChart()
public int getWidthInChart()
Represents the width of the shape, in unit of 1/4000 of the parent shape. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.WidthInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: int
getWidthInShape()
public int getWidthInShape()
Represents the width of the shape, in unit of 1/4000 of the parent shape. Only Applies when this shape in the group or chart.
if (shape.getUpperDeltaY() == 2000)
shape.setUpperDeltaY(4000);
Returns: int
getWidthInch()
public double getWidthInch()
Represents the width of the shape, in unit of inch.
if (shape.getWidthInch() == 3)
shape.setWidthInch(1);
Returns: double
getWidthPt()
public double getWidthPt()
Represents the width of the shape, in unit of point.
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;
if (shape.getWidthScale() == 3)
shape.setWidthScale(1);
Returns: int
getWorksheet()
public Worksheet getWorksheet()
Gets the Range.getWorksheet() object which contains this shape.
Worksheet worksheet = shape.getWorksheet();
Returns: Worksheet
getX()
public int getX()
Gets the horizontal offset of shape from worksheet left border,in unit of pixels.
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.
if (shape.getY() == 3)
shape.setY(1);
Returns: int
getZOrderPosition()
public int getZOrderPosition()
Returns the position of a shape in the z-order.
shape.setZOrderPosition(3);
Returns: int
hasLine()
public boolean hasLine()
Gets the line border of the shape is visible.
if(shape.hasLine() == false)
shape.setHasLine(true);
Returns: boolean
hashCode()
public native int hashCode()
Returns: int
isEquation()
public boolean isEquation()
Indicates whether the shape only contains an equation.
//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.
if(shape.isFilled() == false)
shape.setFilled(true);
Returns: boolean
isFlippedHorizontally()
public boolean isFlippedHorizontally()
Gets whether shape is horizontally flipped .
if(shape.isFlippedHorizontally() == false)
shape.setFlippedHorizontally(true);
Returns: boolean
isFlippedVertically()
public boolean isFlippedVertically()
Gets whether shape is vertically flipped .
if(shape.isFlippedVertically() == false)
shape.setFlippedVertically(true);
Returns: boolean
isGroup()
public boolean isGroup()
Indicates whether the shape is a group.
if(shape.isGroup())
{
//This shape is a group.
}
Returns: boolean
isHidden()
public boolean isHidden()
Indicates whether the object is visible.
shape.setHidden(false);
Returns: boolean
isInGroup()
public boolean isInGroup()
Indicates whether the shape is grouped.
Returns: boolean
isLockAspectRatio()
public boolean isLockAspectRatio()
True means that don’t allow changes in aspect ratio.
shape.setLockAspectRatio(false);
Returns: boolean
isLocked()
public boolean isLocked()
True if the object is locked, False if the object can be modified when the sheet is protected.
if(shape.isLocked())
shape.setLocked(false);
Returns: boolean
isPrintable()
public boolean isPrintable()
True if the object is printable
if(shape.isPrintable())
shape.setPrintable(false);
Returns: boolean
isRichText()
public boolean isRichText()
Whether or not the text is rich text.
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.
if (shape.isSameSetting(shape))
System.out.println("Two objects the same.");
Parameters:
Parameter | Type | Description |
---|---|---|
obj | java.lang.Object |
Returns: boolean -
isSmartArt()
public boolean isSmartArt()
Indicates whether the shape is smart art. Only for ooxml file.
//if true,the shape is 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.
if (shape.isTextWrapped())
shape.setTextWrapped(!shape.isTextWrapped());
Returns: boolean
isWordArt()
public boolean isWordArt()
Indicates whether this shape is a word art. Only for the Legacy Shape of xls file.
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.
shape.moveToRange(12, 3, 13, 5);
Parameters:
Parameter | Type | Description |
---|---|---|
upperLeftRow | int | Upper left row index. |
upperLeftColumn | int | Upper left column index. |
lowerRightRow | int | Lower right row index |
lowerRightColumn | int | Lower right column index |
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
removeActiveXControl()
public void removeActiveXControl()
Remove activeX control.
shape.removeActiveXControl();
removeHyperlink()
public void removeHyperlink()
Remove the hyperlink of the shape.
shape.removeHyperlink();
setAlternativeText(String value)
public void setAlternativeText(String value)
Returns or sets the descriptive (alternative) text string of the Shape object.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setAnchorType(int value)
public void setAnchorType(int value)
Sets the shape anchor placeholder.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setAutoShapeType(int value)
public void setAutoShapeType(int value)
Sets the auto shape type.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
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:
Parameter | Type | Description |
---|---|---|
value | int |
setCreateId(UUID value)
public void setCreateId(UUID value)
Sets create id for this shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.util.UUID |
setFilled(boolean value)
public void setFilled(boolean value)
Indicates whether the fill format is visible.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setFlippedHorizontally(boolean value)
public void setFlippedHorizontally(boolean value)
Sets whether shape is horizontally flipped .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setFlippedVertically(boolean value)
public void setFlippedVertically(boolean value)
Sets whether shape is vertically flipped .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setFont(Font value)
public void setFont(Font value)
Represents the font of shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Font |
setHasLine(boolean value)
public void setHasLine(boolean value)
Sets the line border of the shape is visible.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setHeight(int value)
public void setHeight(int value)
Represents the height of shape, in unit of pixel.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setHeightCM(double value)
public void setHeightCM(double value)
Represents the height of the shape, in unit of centimeters.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setHeightInChart(int value)
public void setHeightInChart(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.. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.HeightInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
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.. Only Applies when this shape in the group or chart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setHeightInch(double value)
public void setHeightInch(double value)
Represents the height of the shape, in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setHeightPt(double value)
public void setHeightPt(double value)
Represents the height of the shape, in unit of points.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
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:
Parameter | Type | Description |
---|---|---|
value | int |
setHidden(boolean value)
public void setHidden(boolean value)
Indicates whether the object is visible.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setHtmlText(String value)
public void setHtmlText(String value)
Sets the html string which contains data and some formats in this textbox.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setInputRange(String value)
public void setInputRange(String value)
Sets the worksheet range used to fill the specified combo box.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.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.
//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.
//Initialize a new workbook.
//Workbook book = new Workbook();
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:
Parameter | Type | Description |
---|---|---|
formula | java.lang.String | The range used to fill the control. |
isR1C1 | boolean | Whether the formula needs to be formatted as R1C1. |
isLocal | boolean | Whether 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:
Parameter | Type | Description |
---|---|---|
value | int |
setLeftCM(double value)
public void setLeftCM(double value)
Represents the horizontal offset of shape from its left column, in unit of centimeters.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setLeftInChart(int value)
public void setLeftInChart(int value)
Represents the vertical offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.LeftInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
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. Only Applies when this shape in the group or chart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setLeftInch(double value)
public void setLeftInch(double value)
Represents the horizontal offset of shape from its left column, in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setLeftToCorner(int value)
public void setLeftToCorner(int value)
Sets the horizonal offset of shape from worksheet left border.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setLinkedCell(String value)
public void setLinkedCell(String value)
Sets the worksheet range linked to the control’s value.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.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.
//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:
Parameter | Type | Description |
---|---|---|
formula | java.lang.String | The range linked to the control’s value. |
isR1C1 | boolean | Whether the formula needs to be formatted as R1C1. |
isLocal | boolean | Whether the formula needs to be formatted by locale. |
setLockAspectRatio(boolean value)
public void setLockAspectRatio(boolean value)
True means that don’t allow changes in aspect ratio.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setLocked(boolean value)
public void setLocked(boolean value)
True if the object is locked, False if the object can be modified when the sheet is protected.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setLockedProperty(int type, boolean value)
public void setLockedProperty(int type, boolean value)
Set the locked property.
shape.setLockedProperty(ShapeLockType.ADJUST_HANDLES, true);
Parameters:
Parameter | Type | Description |
---|---|---|
type | int | The locked type. |
value | boolean | The value of the property. |
setLowerDeltaX(int value)
public void setLowerDeltaX(int value)
Sets the shape’s horizontal offset from its lower right corner column. The range of value is 0 to 1024.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setLowerDeltaY(int value)
public void setLowerDeltaY(int value)
Sets the shape’s vertical offset from its lower right corner row. The range of value is 0 to 256.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setLowerRightColumn(int value)
public void setLowerRightColumn(int value)
Represents lower right corner column index.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setLowerRightRow(int value)
public void setLowerRightRow(int value)
Represents lower right corner row index.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setMacroName(String value)
public void setMacroName(String value)
Sets the name of macro.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setName(String value)
public void setName(String value)
Sets the name of the shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.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.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setPositionX(int value)
public void setPositionX(int value)
Sets the horizonal offset of shape from worksheet left border,in unit of pixels. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.X property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setPositionY(int value)
public void setPositionY(int value)
Sets the vertical offset of shape from worksheet top border,in unit of pixels. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.Y property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setPrintable(boolean value)
public void setPrintable(boolean value)
True if the object is printable
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setRelativeToOriginalPictureSize(boolean value)
public void setRelativeToOriginalPictureSize(boolean value)
Indicates whether shape is relative to original picture size.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
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:
Parameter | Type | Description |
---|---|---|
value | int |
setRotationAngle(double value)
public void setRotationAngle(double value)
Sets the rotation of the shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setSoftEdges(double value)
public void setSoftEdges(double value)
Sets the radius of blur to apply to the edges, in unit of points.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setText(String value)
public void setText(String value)
Represents the string in this TextBox object.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setTextDirection(int value)
public void setTextDirection(int value)
Sets the direction of the text flow for this object.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextHorizontalAlignment(int value)
public void setTextHorizontalAlignment(int value)
Sets the text horizontal alignment type of the shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextHorizontalOverflow(int value)
public void setTextHorizontalOverflow(int value)
Sets the text horizontal overflow type of the shape which contains text.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextOptions(TextOptions value)
public void setTextOptions(TextOptions value)
Represents the text options of the shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | TextOptions |
setTextOrientationType(int value)
public void setTextOrientationType(int value)
Sets the text orientation type of the shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextShapeType(int value)
public void setTextShapeType(int value)
Sets the preset text shape type.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextVerticalAlignment(int value)
public void setTextVerticalAlignment(int value)
Sets the text vertical alignment type of the shape.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextVerticalOverflow(int value)
public void setTextVerticalOverflow(int value)
Sets the text vertical overflow type of the shape which contains text.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTextWrapped(boolean value)
public void setTextWrapped(boolean value)
Sets the text wrapped type of the shape which contains text.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setTitle(String value)
public void setTitle(String value)
Specifies the title (caption) of the current shape object.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setTop(int value)
public void setTop(int value)
Represents the vertical offset of shape from its top row, in unit of pixels. If the shape is in the chart, represents the vertical offset of shape from its top border.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTopCM(double value)
public void setTopCM(double value)
Represents the vertical offset of shape from its top row, in unit of centimeters.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setTopInChart(int value)
public void setTopInChart(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. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.TopInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
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. Only Applies when this shape in the group or chart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setTopInch(double value)
public void setTopInch(double value)
Represents the vertical offset of shape from its top row, in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setTopToCorner(int value)
public void setTopToCorner(int value)
Sets the vertical offset of shape from worksheet top border, in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setUpperDeltaX(int value)
public void setUpperDeltaX(int value)
Sets the shape’s horizontal offset from its upper left corner column. The range of value is 0 to 1024.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setUpperDeltaY(int value)
public void setUpperDeltaY(int value)
Sets the shape’s vertical offset from its upper left corner row. The range of value is 0 to 256.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setUpperLeftColumn(int value)
public void setUpperLeftColumn(int value)
Represents upper left corner column index.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setUpperLeftRow(int value)
public void setUpperLeftRow(int value)
Represents upper left corner row index. If the shape is in the shape or in the group , UpperLeftRow will be ignored.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setWidth(int value)
public void setWidth(int value)
Represents the width of shape, in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setWidthCM(double value)
public void setWidthCM(double value)
Represents the width of the shape, in unit of centimeters.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setWidthInChart(int value)
public void setWidthInChart(int value)
Represents the width of the shape, in unit of 1/4000 of the parent shape. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Drawing.Shape.WidthInShape property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setWidthInShape(int value)
public void setWidthInShape(int value)
Represents the width of the shape, in unit of 1/4000 of the parent shape. Only Applies when this shape in the group or chart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setWidthInch(double value)
public void setWidthInch(double value)
Represents the width of the shape, in unit of inch.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setWidthPt(double value)
public void setWidthPt(double value)
Represents the width of the shape, in unit of point.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
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:
Parameter | Type | Description |
---|---|---|
value | int |
setX(int value)
public void setX(int value)
Sets the horizontal offset of shape from worksheet left border,in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setY(int value)
public void setY(int value)
Sets the vertical offset of shape from worksheet top border,in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setZOrderPosition(int value)
public void setZOrderPosition(int value)
Returns the position of a shape in the z-order.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
toFrontOrBack(int orders)
public void toFrontOrBack(int orders)
Brings the shape to the front or sends the shape to back.
shape.toFrontOrBack(2);
//or shape.ToFrontOrBack(-1);
Parameters:
Parameter | Type | Description |
---|---|---|
orders | int | If 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.
The following formats are supported: .bmp, .gif, .jpg, .jpeg, .tiff, .emf.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The output stream. |
imageFormat | ImageFormat | The 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:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | |
options | ImageOrPrintOptions |
toImage(String imageFile, ImageOrPrintOptions options)
public void toImage(String imageFile, ImageOrPrintOptions options)
Saves the shape to a file.
ImageOrPrintOptions op = new ImageOrPrintOptions();
shape.toImage("exmaple.png", op);
Parameters:
Parameter | Type | Description |
---|---|---|
imageFile | java.lang.String | |
options | ImageOrPrintOptions |
toString()
public String toString()
Returns: java.lang.String
updateSelectedValue()
public void updateSelectedValue()
Update the selected value by the value of the linked cell.
//Initialize a new workbook.
//Workbook book = new Workbook();
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:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |