public final class AutoShape extends GeometryShape implements IAutoShape
Represents an AutoShape.
| Modifier and Type | Method and Description |
|---|---|
ITextFrame |
addTextFrame(java.lang.String text)
Adds a new TextFrame to a shape.
|
IAutoShapeLock |
getAutoShapeLock()
Returns autoshape's locks.
|
IAutoShapeLock |
getShapeLock()
Returns shape's locks.
|
ITextFrame |
getTextFrame()
Returns TextFrame object for the AutoShape.
|
boolean |
getUseBackgroundFill()
Determines whether this autoshape should be filled with slide's background fill instead of specified by style or fill format.
|
boolean |
isTextBox()
Specifies if the shape is a text box.
|
void |
setUseBackgroundFill(boolean value)
Determines whether this autoshape should be filled with slide's background fill instead of specified by style or fill format.
|
createShapeElements, getAdjustments, getGeometryPaths, getShapeStyle, getShapeType, setGeometryPath, setGeometryPaths, setShapeTypeaddPlaceholder, getAlternativeText, getAlternativeTextTitle, getBasePlaceholder, getBlackWhiteMode, getConnectionSiteCount, getCustomData, getEffectFormat, getFillFormat, getFrame, getHeight, getHidden, getHyperlinkClick, getHyperlinkManager, getHyperlinkMouseOver, getImage, getImage, getLineFormat, getName, getOfficeInteropShapeId, getParent_Immediate, getParentGroup, getPlaceholder, getPresentation, getRawFrame, getRotation, getSlide, getThreeDFormat, getThumbnail, getThumbnail, getUniqueId, getWidth, getX, getY, getZOrderPosition, isDecorative, isGrouped, isTextHolder, removePlaceholder, setAlternativeText, setAlternativeTextTitle, setBlackWhiteMode, setDecorative, setFrame, setHeight, setHidden, setHyperlinkClick, setHyperlinkMouseOver, setName, setRawFrame, setRotation, setWidth, setX, setY, writeAsSvg, writeAsSvgequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateShapeElements, getAdjustments, getGeometryPaths, getShapeStyle, getShapeType, setGeometryPath, setGeometryPaths, setShapeTypeaddPlaceholder, getAlternativeText, getAlternativeTextTitle, getBasePlaceholder, getBlackWhiteMode, getConnectionSiteCount, getCustomData, getEffectFormat, getFillFormat, getFrame, getHeight, getHidden, getImage, getImage, getLineFormat, getName, getOfficeInteropShapeId, getParentGroup, getPlaceholder, getRawFrame, getRotation, getThreeDFormat, getThumbnail, getThumbnail, getUniqueId, getWidth, getX, getY, getZOrderPosition, isDecorative, isGrouped, isTextHolder, removePlaceholder, setAlternativeText, setAlternativeTextTitle, setBlackWhiteMode, setDecorative, setFrame, setHeight, setHidden, setName, setRawFrame, setRotation, setWidth, setX, setY, writeAsSvg, writeAsSvggetSlidegetPresentationgetHyperlinkClick, getHyperlinkManager, getHyperlinkMouseOver, setHyperlinkClick, setHyperlinkMouseOverpublic final IAutoShapeLock getShapeLock()
Returns shape's locks.
Read-only IAutoShapeLock.
getShapeLock in interface IShapegetShapeLock in class Shapepublic final IAutoShapeLock getAutoShapeLock()
Returns autoshape's locks.
Read-only IAutoShapeLock.
getAutoShapeLock in interface IAutoShapepublic final ITextFrame getTextFrame()
Returns TextFrame object for the AutoShape.
Read-only ITextFrame.
getTextFrame in interface IAutoShapepublic final boolean getUseBackgroundFill()
Determines whether this autoshape should be filled with slide's background fill instead of specified by style or fill format. Read/write boolean.
getUseBackgroundFill in interface IAutoShapepublic final void setUseBackgroundFill(boolean value)
Determines whether this autoshape should be filled with slide's background fill instead of specified by style or fill format. Read/write boolean.
setUseBackgroundFill in interface IAutoShapepublic final ITextFrame addTextFrame(java.lang.String text)
Adds a new TextFrame to a shape. If shape already has TextFrame then simply changes its text.
The following sample code shows how to add watermark text in PowerPoint Presentation.Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); IAutoShape watermarkShape = slide.getShapes().addAutoShape(ShapeType.Triangle, 0, 0, 150, 50); ITextFrame watermarkTextFrame = watermarkShape.addTextFrame("Watermark"); } finally { if (pres != null) pres.dispose(); }The following example shows how to create Text Box on Slide.// Instantiates Presentation Presentation pres = new Presentation(); try { // Gets the first slide in the presentation ISlide sld = pres.getSlides().get_Item(0); // Adds an AutoShape with type set as Rectangle IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 75, 150, 50); // Adds TextFrame to the Rectangle ashp.addTextFrame(" "); // Accesses the text frame ITextFrame txtFrame = ashp.getTextFrame(); // Creates the Paragraph object for text frame IParagraph para = txtFrame.getParagraphs().get_Item(0); // Creates a Portion object for the paragraph IPortion portion = para.getPortions().get_Item(0); // Sets the text portion.setText("Aspose TextBox"); // Saves the presentation to disk pres.save("TextBox_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }The following example shows how to add column in Text Box.Presentation pres = new Presentation(); try { // Gets the first slide in the presentation ISlide slide = pres.getSlides().get_Item(0); // Add an AutoShape with type set as Rectangle IAutoShape aShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 300, 300); // Add TextFrame to the Rectangle aShape.addTextFrame("All these columns are limited to be within a single text container -- " + "you can add or delete text and the new or remaining text automatically adjusts " + "itself to flow within the container. You cannot have text flow from one container " + "to other though -- we told you PowerPoint's column options for text are limited!"); // Gets the text format of TextFrame ITextFrameFormat format = aShape.getTextFrame().getTextFrameFormat(); // Specifies the number of columns in TextFrame format.setColumnCount(3); // Specifies the spacing between columns format.setColumnSpacing(10); // Saves the presentation pres.save("ColumnCount.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addTextFrame in interface IAutoShapetext - Default text for a new TextFrame.ITextFrame object.public final boolean isTextBox()
Specifies if the shape is a text box.
isTextBox in interface IAutoShapeCopyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.