IShape

All Implemented Interfaces: com.aspose.slides.ISlideComponent, com.aspose.slides.IHyperlinkContainer

public interface IShape extends ISlideComponent, IHyperlinkContainer

Represents a shape on a slide.

Methods

MethodDescription
isTextHolder()Determines whether the shape is TextHolder.
getPlaceholder()Returns the placeholder for a shape.
addPlaceholder(IPlaceholder placeholderToCopyFrom)Adds a new placeholder if there is no and sets placeholder properties to a specified one.
removePlaceholder()Defines that this shape isn’t a placeholder.
getCustomData()Returns the shape’s custom data.
getRawFrame()Returns or sets the raw shape frame’s properties.
setRawFrame(IShapeFrame value)Returns or sets the raw shape frame’s properties.
getFrame()Returns or sets the shape frame’s properties.
setFrame(IShapeFrame value)Returns or sets the shape frame’s properties.
getLineFormat()Returns the LineFormat object that contains line formatting properties for a shape.
getThreeDFormat()Returns the ThreeDFormat object that contains line formatting properties for a shape.
getEffectFormat()Returns the EffectFormat object which contains pixel effects applied to a shape.
getFillFormat()Returns the FillFormat object that contains fill formatting properties for a shape.
getThumbnail()Returns shape thumbnail.
getImage()Returns shape thumbnail.
getThumbnail(int bounds, float scaleX, float scaleY)Returns shape thumbnail.
getImage(int bounds, float scaleX, float scaleY)Returns shape thumbnail.
getHidden()Determines whether the shape is hidden.
setHidden(boolean value)Determines whether the shape is hidden.
getZOrderPosition()Returns the position of a shape in the z-order.
getConnectionSiteCount()Returns the number of connection sites on the shape.
getRotation()Returns or sets the number of degrees the specified shape is rotated around the z-axis.
setRotation(float value)Returns or sets the number of degrees the specified shape is rotated around the z-axis.
getX()Returns or sets the x-coordinate of the upper-left corner of the shape.
setX(float value)Returns or sets the x-coordinate of the upper-left corner of the shape.
getY()Returns or sets the y-coordinate of the upper-left corner of the shape.
setY(float value)Returns or sets the y-coordinate of the upper-left corner of the shape.
getWidth()Returns or sets the width of the shape.
setWidth(float value)Returns or sets the width of the shape.
getHeight()Returns or sets the height of the shape.
setHeight(float value)Returns or sets the height of the shape.
getAlternativeText()Returns or sets the alternative text associated with a shape.
setAlternativeText(String value)Returns or sets the alternative text associated with a shape.
getAlternativeTextTitle()Returns or sets the title of alternative text associated with a shape.
setAlternativeTextTitle(String value)Returns or sets the title of alternative text associated with a shape.
getName()Returns or sets the name of a shape.
setName(String value)Returns or sets the name of a shape.
isDecorative()Gets or sets ‘Mark as decorative’ option Reed/write boolean .
setDecorative(boolean value)Gets or sets ‘Mark as decorative’ option Reed/write boolean .
getShapeLock()Returns shape’s locks.
getUniqueId()Gets unique shape identifier in presentation scope.
getOfficeInteropShapeId()Gets unique shape identifier in slide scope.
isGrouped()Determines whether the shape is grouped.
getBlackWhiteMode()Property specifies how a shape will render in black-and-white display mode..
setBlackWhiteMode(byte value)Property specifies how a shape will render in black-and-white display mode..
getParentGroup()Returns parent GroupShape object if shape is grouped.
writeAsSvg(OutputStream stream)Saves content of Shape as SVG file.
writeAsSvg(OutputStream stream, ISVGOptions svgOptions)Saves content of Shape as SVG file.
getBasePlaceholder()Returns a basic placeholder shape (shape from the layout and/or master slide that the current shape is inherited from).

isTextHolder()

public abstract boolean isTextHolder()

Determines whether the shape is TextHolder. Read-only boolean.

Returns: boolean

getPlaceholder()

public abstract IPlaceholder getPlaceholder()

Returns the placeholder for a shape. Read-only IPlaceholder.

Returns: IPlaceholder

addPlaceholder(IPlaceholder placeholderToCopyFrom)

public abstract IPlaceholder addPlaceholder(IPlaceholder placeholderToCopyFrom)

Adds a new placeholder if there is no and sets placeholder properties to a specified one.

Parameters:

ParameterTypeDescription
placeholderToCopyFromIPlaceholderPlaceholder to copy content from.

Returns: IPlaceholder - New IPlaceholder.

removePlaceholder()

public abstract void removePlaceholder()

Defines that this shape isn’t a placeholder.

getCustomData()

public abstract ICustomData getCustomData()

Returns the shape’s custom data. Read-only ICustomData.

Returns: ICustomData

getRawFrame()

public abstract IShapeFrame getRawFrame()

Returns or sets the raw shape frame’s properties. Read/write IShapeFrame.


Code that attempts to assign undefined frame to IShape.getFrame() doesn't make sence in general case (particulary in case when parent GroupShape is multiple nested into other GroupShape-s). For example:
 
 IShape shape = ...;
 shape.setFrame(new ShapeFrame(Float.NaN, Float.NaN, Float.NaN, Float.NaN, NullableBool.NotDefined, NullableBool.NotDefined, Float.NaN));
 //or
 slide.getShapes().addAutoShape(ShapeType.RoundCornerRectangle, Float.NaN, Float.NaN, Float.NaN, Float.NaN);
 //Such code can lead to unclear situations. So restrictions had been added for using undefined values for IShape.getFrame(). Values of x, y, width, height, flipH, flipV and rotationAngle must be defined (not Float.NaN or NullableBool.NotDefined). Example code above now throws ArgumentException exception.
 //This applies to these use cases:
 IShape shape = ...;
 shape.setFrame(...); // cannot be undefined
 IShapeCollection shapes = ...;
 // x, y, width, height parameters cannot be Float.NaN:
 {
     shapes.addAudioFrameCD(...);
     shapes.addAudioFrameEmbedded(...);
     shapes.addAudioFrameLinked(...);
     shapes.addAutoShape(...);
     shapes.addChart(...);
     shapes.addConnector(...);
     shapes.addOleObjectFrame(...);
     shapes.addPictureFrame(...);
     shapes.addSmartArt(...);
     shapes.addTable(...);
     shapes.addVideoFrame(...);
     shapes.insertAudioFrameEmbedded(...);
     shapes.insertAudioFrameLinked(...);
     shapes.insertAutoShape(...);
     shapes.insertChart(...);
     shapes.insertConnector(...);
     shapes.insertOleObjectFrame(...);
     shapes.insertPictureFrame(...);
     shapes.insertTable(...);
     shapes.insertVideoFrame(...);
 }
 //But IShape.RawFrame frame properties can be undefined. This make sence when shape is linked to placeholder. Then undefined shape frame values is overridden from the parent placeholder shape. If there is no parent placeholder shape for that shape then that shape uses default values when it evaluates effective frame based on its IShape.RawFrame. Default values are 0 and NullableBool.False for x, y, width, height, flipH, flipV and rotationAngle. For example:
 IShape shape = ...; // shape is linked to placeholder
 shape.setRawFrame(new ShapeFrame(Float.NaN, Float.NaN, 100, Float.NaN, NullableBool.NotDefined, NullableBool.NotDefined, 0)); // now shape inherits x, y, height, flipH, flipV values form placeholder and overrides width=100 and rotationAngle=0.{code}

Returns: IShapeFrame

setRawFrame(IShapeFrame value)

public abstract void setRawFrame(IShapeFrame value)

Returns or sets the raw shape frame’s properties. Read/write IShapeFrame.


Code that attempts to assign undefined frame to IShape.getFrame() doesn't make sence in general case (particulary in case when parent GroupShape is multiple nested into other GroupShape-s). For example:
 
 IShape shape = ...;
 shape.setFrame(new ShapeFrame(Float.NaN, Float.NaN, Float.NaN, Float.NaN, NullableBool.NotDefined, NullableBool.NotDefined, Float.NaN));
 //or
 slide.getShapes().addAutoShape(ShapeType.RoundCornerRectangle, Float.NaN, Float.NaN, Float.NaN, Float.NaN);
 //Such code can lead to unclear situations. So restrictions had been added for using undefined values for IShape.getFrame(). Values of x, y, width, height, flipH, flipV and rotationAngle must be defined (not Float.NaN or NullableBool.NotDefined). Example code above now throws ArgumentException exception.
 //This applies to these use cases:
 IShape shape = ...;
 shape.setFrame(...); // cannot be undefined
 IShapeCollection shapes = ...;
 // x, y, width, height parameters cannot be Float.NaN:
 {
     shapes.addAudioFrameCD(...);
     shapes.addAudioFrameEmbedded(...);
     shapes.addAudioFrameLinked(...);
     shapes.addAutoShape(...);
     shapes.addChart(...);
     shapes.addConnector(...);
     shapes.addOleObjectFrame(...);
     shapes.addPictureFrame(...);
     shapes.addSmartArt(...);
     shapes.addTable(...);
     shapes.addVideoFrame(...);
     shapes.insertAudioFrameEmbedded(...);
     shapes.insertAudioFrameLinked(...);
     shapes.insertAutoShape(...);
     shapes.insertChart(...);
     shapes.insertConnector(...);
     shapes.insertOleObjectFrame(...);
     shapes.insertPictureFrame(...);
     shapes.insertTable(...);
     shapes.insertVideoFrame(...);
 }
 //But IShape.RawFrame frame properties can be undefined. This make sence when shape is linked to placeholder. Then undefined shape frame values is overridden from the parent placeholder shape. If there is no parent placeholder shape for that shape then that shape uses default values when it evaluates effective frame based on its IShape.RawFrame. Default values are 0 and NullableBool.False for x, y, width, height, flipH, flipV and rotationAngle. For example:
 IShape shape = ...; // shape is linked to placeholder
 shape.setRawFrame(new ShapeFrame(Float.NaN, Float.NaN, 100, Float.NaN, NullableBool.NotDefined, NullableBool.NotDefined, 0)); // now shape inherits x, y, height, flipH, flipV values form placeholder and overrides width=100 and rotationAngle=0.{code}

Parameters:

ParameterTypeDescription
valueIShapeFrame

getFrame()

public abstract IShapeFrame getFrame()

Returns or sets the shape frame’s properties. Read/write IShapeFrame.


Value of each property of the returned IShapeFrame instance is not undefined (is not NaN or NotDefined). Value of each property of the assigned IShapeFrame instance must be not undefined (must be not NaN or NotDefined). You can set undefined values for RawFrame instance properties.

Returns: IShapeFrame

setFrame(IShapeFrame value)

public abstract void setFrame(IShapeFrame value)

Returns or sets the shape frame’s properties. Read/write IShapeFrame.


Value of each property of the returned IShapeFrame instance is not undefined (is not NaN or NotDefined). Value of each property of the assigned IShapeFrame instance must be not undefined (must be not NaN or NotDefined). You can set undefined values for RawFrame instance properties.

Parameters:

ParameterTypeDescription
valueIShapeFrame

getLineFormat()

public abstract ILineFormat getLineFormat()

Returns the LineFormat object that contains line formatting properties for a shape. Read-only ILineFormat.

Returns: ILineFormat

getThreeDFormat()

public abstract IThreeDFormat getThreeDFormat()

Returns the ThreeDFormat object that contains line formatting properties for a shape. Read-only IThreeDFormat.

Returns: IThreeDFormat

getEffectFormat()

public abstract IEffectFormat getEffectFormat()

Returns the EffectFormat object which contains pixel effects applied to a shape. Read-only IEffectFormat.

Returns: IEffectFormat

getFillFormat()

public abstract IFillFormat getFillFormat()

Returns the FillFormat object that contains fill formatting properties for a shape. Read-only IFillFormat.

Returns: IFillFormat

getThumbnail()

public abstract BufferedImage getThumbnail()

Returns shape thumbnail. ShapeThumbnailBounds.Shape shape thumbnail bounds type is used by default.

Returns: java.awt.image.BufferedImage - Shape thumbnail.

getImage()

public abstract IImage getImage()

Returns shape thumbnail. ShapeThumbnailBounds.Shape shape thumbnail bounds type is used by default.

Returns: IImage - Shape thumbnail.

getThumbnail(int bounds, float scaleX, float scaleY)

public abstract BufferedImage getThumbnail(int bounds, float scaleX, float scaleY)

Returns shape thumbnail.

Parameters:

ParameterTypeDescription
boundsintShape thumbnail bounds type.
scaleXfloatX scale
scaleYfloatY scale

Returns: java.awt.image.BufferedImage - Shape thumbnail or null in case when ShapeThumbnailBounds.Appearance is used and a shape doesn’t have visible elements.

getImage(int bounds, float scaleX, float scaleY)

public abstract IImage getImage(int bounds, float scaleX, float scaleY)

Returns shape thumbnail.

Parameters:

ParameterTypeDescription
boundsintShape thumbnail bounds type.
scaleXfloatX scale
scaleYfloatY scale

Returns: IImage - Shape thumbnail or null in case when ShapeThumbnailBounds.Appearance is used and a shape doesn’t have visible elements.

getHidden()

public abstract boolean getHidden()

Determines whether the shape is hidden. Read/write boolean.

Returns: boolean

setHidden(boolean value)

public abstract void setHidden(boolean value)

Determines whether the shape is hidden. Read/write boolean.

Parameters:

ParameterTypeDescription
valueboolean

getZOrderPosition()

public abstract int getZOrderPosition()

Returns the position of a shape in the z-order. Shapes[0] returns the shape at the back of the z-order, and Shapes[Shapes.Count - 1] returns the shape at the front of the z-order. Read-only int.

Returns: int

getConnectionSiteCount()

public abstract int getConnectionSiteCount()

Returns the number of connection sites on the shape. Read-only int.

Returns: int

getRotation()

public abstract float getRotation()

Returns or sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Returns: float

setRotation(float value)

public abstract void setRotation(float value)

Returns or sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Parameters:

ParameterTypeDescription
valuefloat

getX()

public abstract float getX()

Returns or sets the x-coordinate of the upper-left corner of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Returns: float

setX(float value)

public abstract void setX(float value)

Returns or sets the x-coordinate of the upper-left corner of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Parameters:

ParameterTypeDescription
valuefloat

getY()

public abstract float getY()

Returns or sets the y-coordinate of the upper-left corner of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Returns: float

setY(float value)

public abstract void setY(float value)

Returns or sets the y-coordinate of the upper-left corner of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Parameters:

ParameterTypeDescription
valuefloat

getWidth()

public abstract float getWidth()

Returns or sets the width of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Returns: float

setWidth(float value)

public abstract void setWidth(float value)

Returns or sets the width of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Parameters:

ParameterTypeDescription
valuefloat

getHeight()

public abstract float getHeight()

Returns or sets the height of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Returns: float

setHeight(float value)

public abstract void setHeight(float value)

Returns or sets the height of the shape. Read/write float.


Returned value is always defined (is not Float.NaN). Assigned value must be defined (not Float.NaN). You can set undefined values for RawFrame instance properties.

Parameters:

ParameterTypeDescription
valuefloat

getAlternativeText()

public abstract String getAlternativeText()

Returns or sets the alternative text associated with a shape. Read/write String.

Returns: java.lang.String

setAlternativeText(String value)

public abstract void setAlternativeText(String value)

Returns or sets the alternative text associated with a shape. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getAlternativeTextTitle()

public abstract String getAlternativeTextTitle()

Returns or sets the title of alternative text associated with a shape. Read/write String.

Returns: java.lang.String

setAlternativeTextTitle(String value)

public abstract void setAlternativeTextTitle(String value)

Returns or sets the title of alternative text associated with a shape. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getName()

public abstract String getName()

Returns or sets the name of a shape. Read/write String.

Returns: java.lang.String

setName(String value)

public abstract void setName(String value)

Returns or sets the name of a shape. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

isDecorative()

public abstract boolean isDecorative()

Gets or sets ‘Mark as decorative’ option Reed/write boolean .


Presentation pres = new Presentation("sample.pptx");
 try {
    pres.getSlides().get_Item(0).getShapes().get_Item(0).setDecorative(true);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: boolean

setDecorative(boolean value)

public abstract void setDecorative(boolean value)

Gets or sets ‘Mark as decorative’ option Reed/write boolean .


Presentation pres = new Presentation("sample.pptx");
 try {
    pres.getSlides().get_Item(0).getShapes().get_Item(0).setDecorative(true);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valueboolean

getShapeLock()

public abstract IBaseShapeLock getShapeLock()

Returns shape’s locks. Read-only IBaseShapeLock.

Returns: IBaseShapeLock

getUniqueId()

public abstract long getUniqueId()

Gets unique shape identifier in presentation scope. Read-only long. See also #getOfficeInteropShapeId.getOfficeInteropShapeId for getting unique shape identifier in slide scope.

Returns: long

getOfficeInteropShapeId()

public abstract long getOfficeInteropShapeId()

Gets unique shape identifier in slide scope. Read-only long. See also #getUniqueId.getUniqueId for getting unique shape identifier in presentation scope.

Returns: long

isGrouped()

public abstract boolean isGrouped()

Determines whether the shape is grouped. Read-only boolean.


Property #getParentGroup.getParentGroup returns parent GroupShape object if shape is grouped.

Returns: boolean

getBlackWhiteMode()

public abstract byte getBlackWhiteMode()

Property specifies how a shape will render in black-and-white display mode.. Read/write BlackWhiteMode.

Returns: byte

setBlackWhiteMode(byte value)

public abstract void setBlackWhiteMode(byte value)

Property specifies how a shape will render in black-and-white display mode.. Read/write BlackWhiteMode.

Parameters:

ParameterTypeDescription
valuebyte

getParentGroup()

public abstract IGroupShape getParentGroup()

Returns parent GroupShape object if shape is grouped. Otherwise returns null. Read-only IGroupShape.


Property #isGrouped.isGrouped determines whether the shape is grouped.

Returns: IGroupShape

writeAsSvg(OutputStream stream)

public abstract void writeAsSvg(OutputStream stream)

Saves content of Shape as SVG file.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamTarget stream

writeAsSvg(OutputStream stream, ISVGOptions svgOptions)

public abstract void writeAsSvg(OutputStream stream, ISVGOptions svgOptions)

Saves content of Shape as SVG file.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamTarget stream
svgOptionsISVGOptionsSVG generation options

getBasePlaceholder()

public abstract IShape getBasePlaceholder()

Returns a basic placeholder shape (shape from the layout and/or master slide that the current shape is inherited from).


// get all (master/layout/slide) animated effects of the placeholder shape
 Presentation pres = new Presentation("sample.pptx");
 try {
     ISlide slide = pres.getSlides().get_Item(0);
     IShape shape = slide.getShapes().get_Item(0);
     IEffect[] shapeEffects = slide.getLayoutSlide().getTimeline().getMainSequence().getEffectsByShape(shape);
     IShape layoutShape = shape.getBasePlaceholder();
     IEffect[] layoutShapeEffects = slide.getLayoutSlide().getTimeline().getMainSequence().getEffectsByShape(layoutShape);
     IShape masterShape = layoutShape.getBasePlaceholder();
     IEffect[] masterShapeEffects = slide.getLayoutSlide().getMasterSlide().getTimeline().getMainSequence().getEffectsByShape(masterShape);
 } finally {
     if (pres != null) pres.dispose();
 }

A null is returned if the current shape is not inherited.

Returns: IShape