public interface IShape extends ISlideComponent, IHyperlinkContainer
Represents a shape on a slide.
| Modifier and Type | Method and Description |
|---|---|
IPlaceholder |
addPlaceholder(IPlaceholder placeholderToCopyFrom)
Adds a new placeholder if there is no and sets placeholder properties to a specified one.
|
java.lang.String |
getAlternativeText()
Returns or sets the alternative text associated with a shape.
|
java.lang.String |
getAlternativeTextTitle()
Returns or sets the title of alternative text associated with a shape.
|
IShape |
getBasePlaceholder()
Returns a basic placeholder shape (shape from the layout and/or master slide that the current shape is inherited from).
|
byte |
getBlackWhiteMode()
Property specifies how a shape will render in black-and-white display mode..
|
int |
getConnectionSiteCount()
Returns the number of connection sites on the shape.
|
ICustomData |
getCustomData()
Returns the shape's custom data.
|
IEffectFormat |
getEffectFormat()
Returns the EffectFormat object which contains pixel effects applied to a shape.
|
IFillFormat |
getFillFormat()
Returns the FillFormat object that contains fill formatting properties for a shape.
|
IShapeFrame |
getFrame()
Returns or sets the shape frame's properties.
|
float |
getHeight()
Gets or sets the height of the shape, measured in points.
|
boolean |
getHidden()
Determines whether the shape is hidden.
|
IImage |
getImage()
Returns shape thumbnail.
|
IImage |
getImage(int bounds,
float scaleX,
float scaleY)
Returns shape thumbnail.
|
ILineFormat |
getLineFormat()
Returns the LineFormat object that contains line formatting properties for a shape.
|
java.lang.String |
getName()
Returns or sets the name of a shape.
|
long |
getOfficeInteropShapeId()
Returns a slide-scoped unique identifier that remains constant for the lifetime of the shape and
lets PowerPoint or interop code reliably reference the shape from anywhere in the document.
|
IGroupShape |
getParentGroup()
Returns parent GroupShape object if shape is grouped.
|
IPlaceholder |
getPlaceholder()
Returns the placeholder for a shape.
|
IShapeFrame |
getRawFrame()
Returns or sets the raw shape frame's properties.
|
float |
getRotation()
Returns or sets the number of degrees the specified shape is rotated around
the z-axis.
|
IBaseShapeLock |
getShapeLock()
Returns shape's locks.
|
IThreeDFormat |
getThreeDFormat()
Returns the ThreeDFormat object that contains line formatting properties for a shape.
|
java.awt.image.BufferedImage |
getThumbnail()
Deprecated.
Use getImage method instead. The method will be removed after release of version 24.7.
|
java.awt.image.BufferedImage |
getThumbnail(int bounds,
float scaleX,
float scaleY)
Deprecated.
Use getImage(ShapeThumbnailBounds bounds, float scaleX, float scaleY) method instead. The method will be removed after release of version 24.7.
|
long |
getUniqueId()
Returns an internal, presentation-scoped identifier intended for use by add-ins or other code.
|
float |
getWidth()
Gets or sets the width of the shape, measured in points.
|
float |
getX()
Gets or sets the x-coordinate of the shape's upper-left corner, measured in points.
|
float |
getY()
Gets or sets the y-coordinate of the shape's upper-left corner, measured in points.
|
int |
getZOrderPosition()
Returns the position of a shape in the z-order.
|
boolean |
isDecorative()
Gets or sets 'Mark as decorative' option
Reed/write boolean.
|
boolean |
isGrouped()
Determines whether the shape is grouped.
|
boolean |
isTextHolder()
Determines whether the shape is TextHolder.
|
void |
removePlaceholder()
Defines that this shape isn't a placeholder.
|
void |
setAlternativeText(java.lang.String value)
Returns or sets the alternative text associated with a shape.
|
void |
setAlternativeTextTitle(java.lang.String value)
Returns or sets the title of alternative text associated with a shape.
|
void |
setBlackWhiteMode(byte value)
Property specifies how a shape will render in black-and-white display mode..
|
void |
setDecorative(boolean value)
Gets or sets 'Mark as decorative' option
Reed/write boolean.
|
void |
setFrame(IShapeFrame value)
Returns or sets the shape frame's properties.
|
void |
setHeight(float value)
Gets or sets the height of the shape, measured in points.
|
void |
setHidden(boolean value)
Determines whether the shape is hidden.
|
void |
setName(java.lang.String value)
Returns or sets the name of a shape.
|
void |
setRawFrame(IShapeFrame value)
Returns or sets the raw shape frame's properties.
|
void |
setRotation(float value)
Returns or sets the number of degrees the specified shape is rotated around
the z-axis.
|
void |
setWidth(float value)
Gets or sets the width of the shape, measured in points.
|
void |
setX(float value)
Gets or sets the x-coordinate of the shape's upper-left corner, measured in points.
|
void |
setY(float value)
Gets or sets the y-coordinate of the shape's upper-left corner, measured in points.
|
void |
writeAsSvg(java.io.OutputStream stream)
Saves content of Shape as SVG file.
|
void |
writeAsSvg(java.io.OutputStream stream,
ISVGOptions svgOptions)
Saves content of Shape as SVG file.
|
getSlidegetPresentationgetHyperlinkClick, getHyperlinkManager, getHyperlinkMouseOver, setHyperlinkClick, setHyperlinkMouseOverboolean isTextHolder()
Determines whether the shape is TextHolder. Read-only boolean.
IPlaceholder getPlaceholder()
Returns the placeholder for a shape.
Read-only IPlaceholder.
IPlaceholder addPlaceholder(IPlaceholder placeholderToCopyFrom)
Adds a new placeholder if there is no and sets placeholder properties to a specified one.
placeholderToCopyFrom - Placeholder to copy content from.IPlaceholder.void removePlaceholder()
Defines that this shape isn't a placeholder.
ICustomData getCustomData()
Returns the shape's custom data.
Read-only ICustomData.
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 sense in general case (particularly 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 sense 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.
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 sense in general case (particularly 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 sense 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.
IShapeFrame getFrame()
Returns or sets the shape frame's properties.
Read/write IShapeFrame.
void setFrame(IShapeFrame value)
Returns or sets the shape frame's properties.
Read/write IShapeFrame.
ILineFormat getLineFormat()
Returns the LineFormat object that contains line formatting properties for a shape.
Read-only ILineFormat.
IThreeDFormat getThreeDFormat()
Returns the ThreeDFormat object that contains line formatting properties for a shape.
Read-only IThreeDFormat.
IEffectFormat getEffectFormat()
Returns the EffectFormat object which contains pixel effects applied to a shape.
Read-only IEffectFormat.
IFillFormat getFillFormat()
Returns the FillFormat object that contains fill formatting properties for a shape.
Read-only IFillFormat.
@Deprecated java.awt.image.BufferedImage getThumbnail()
Returns shape thumbnail. ShapeThumbnailBounds.Shape shape thumbnail bounds type is used by default.
IImage getImage()
Returns shape thumbnail. ShapeThumbnailBounds.Shape shape thumbnail bounds type is used by default.
@Deprecated
java.awt.image.BufferedImage getThumbnail(int bounds,
float scaleX,
float scaleY)
Returns shape thumbnail.
bounds - Shape thumbnail bounds type.scaleX - X scalescaleY - Y scaleIImage getImage(int bounds, float scaleX, float scaleY)
Returns shape thumbnail.
bounds - Shape thumbnail bounds type.scaleX - X scalescaleY - Y scaleboolean getHidden()
Determines whether the shape is hidden. Read/write boolean.
void setHidden(boolean value)
Determines whether the shape is hidden. Read/write boolean.
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.
int getConnectionSiteCount()
Returns the number of connection sites on the shape. Read-only int.
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.
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.
float getX()
Gets or sets the x-coordinate of the shape's upper-left corner, measured in points. Read/write float.
void setX(float value)
Gets or sets the x-coordinate of the shape's upper-left corner, measured in points. Read/write float.
float getY()
Gets or sets the y-coordinate of the shape's upper-left corner, measured in points. Read/write float.
void setY(float value)
Gets or sets the y-coordinate of the shape's upper-left corner, measured in points. Read/write float.
float getWidth()
Gets or sets the width of the shape, measured in points. Read/write float.
void setWidth(float value)
Gets or sets the width of the shape, measured in points. Read/write float.
float getHeight()
Gets or sets the height of the shape, measured in points. Read/write float.
void setHeight(float value)
Gets or sets the height of the shape, measured in points. Read/write float.
java.lang.String getAlternativeText()
Returns or sets the alternative text associated with a shape.
Read/write String.
void setAlternativeText(java.lang.String value)
Returns or sets the alternative text associated with a shape.
Read/write String.
java.lang.String getAlternativeTextTitle()
Returns or sets the title of alternative text associated with a shape.
Read/write String.
void setAlternativeTextTitle(java.lang.String value)
Returns or sets the title of alternative text associated with a shape.
Read/write String.
java.lang.String getName()
Returns or sets the name of a shape.
Read/write String.
void setName(java.lang.String value)
Returns or sets the name of a shape.
Read/write String.
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(); }
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(); }
IBaseShapeLock getShapeLock()
Returns shape's locks.
Read-only IBaseShapeLock.
long getUniqueId()
Returns an internal, presentation-scoped identifier intended for use by add-ins or other code.
Because this value can be reassigned by the user or programmatically, it must not be treated
as a persistent unique key.
Read-only long.
See also getOfficeInteropShapeId().
long getOfficeInteropShapeId()
Returns a slide-scoped unique identifier that remains constant for the lifetime of the shape and
lets PowerPoint or interop code reliably reference the shape from anywhere in the document.
Read-only long.
See also getUniqueId().
boolean isGrouped()
Determines whether the shape is grouped. Read-only boolean.
getParentGroup() returns parent GroupShape object if shape is grouped.
byte getBlackWhiteMode()
Property specifies how a shape will render in black-and-white display mode..
Read/write BlackWhiteMode.
void setBlackWhiteMode(byte value)
Property specifies how a shape will render in black-and-white display mode..
Read/write BlackWhiteMode.
IGroupShape getParentGroup()
Returns parent GroupShape object if shape is grouped. Otherwise returns null.
Read-only IGroupShape.
isGrouped() determines whether the shape is grouped.
void writeAsSvg(java.io.OutputStream stream)
Saves content of Shape as SVG file.
stream - Target streamvoid writeAsSvg(java.io.OutputStream stream,
ISVGOptions svgOptions)
Saves content of Shape as SVG file.
stream - Target streamsvgOptions - SVG generation optionsIShape 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.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(); }
Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.