public final class Shape extends ShapeBase
Using the Shape class you can create or modify shapes in a Microsoft Word document.
An important property of a shape is its ShapeBase.getShapeType(). Shapes of different types can have different capabilities in a Word document. For example, only image and OLE shapes can have images inside them. Most of the shapes can have text, but not all.
Shapes that can have text, can contain Paragraph and Table nodes as children.
ShapeBase,
GroupShape| Constructor and Description |
|---|
Shape(DocumentBase doc,
int shapeType)
Initializes a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(DocumentVisitor visitor)
Accepts a visitor.
|
Chart |
getChart()
Provides access to the chart properties if this shape has a Chart.
|
int |
getDashStyle() |
int |
getEndArrowLength() |
int |
getEndArrowType() |
int |
getEndArrowWidth() |
int |
getEndCap() |
boolean |
getExtrusionEnabled()
Returns true if an extrusion effect is enabled.
|
java.awt.Color |
getFillColor()
Defines the brush color that fills the closed path of the shape.
|
boolean |
getFilled()
Determines whether the closed path of the shape will be filled.
|
Paragraph |
getFirstParagraph()
Gets the first paragraph in the shape.
|
float |
getHorizontalMargins_ITextBox() |
HorizontalRuleFormat |
getHorizontalRuleFormat()
Provides access to the properties of the horizontal rule shape.
|
ImageData |
getImageData()
Provides access to the image of the shape.
|
int |
getJoinStyle() |
Paragraph |
getLastParagraph()
Gets the last paragraph in the shape.
|
int |
getLineFillType() |
int |
getLineStyle() |
byte |
getMarkupLanguage_ITextBox() |
int |
getNodeType()
Returns
NodeType.SHAPE. |
OleFormat |
getOleFormat()
Provides access to the OLE data of a shape.
|
boolean |
getShadowEnabled()
Returns true if a shadow effect is enabled.
|
SignatureLine |
getSignatureLine()
Gets
getSignatureLine() object if the shape is a signature line. |
int |
getStartArrowLength() |
int |
getStartArrowType() |
int |
getStartArrowWidth() |
int |
getStoryType()
Returns
StoryType.TEXTBOX. |
Stroke |
getStroke()
Defines a stroke for a shape.
|
java.awt.Color |
getStrokeColor()
Defines the color of a stroke.
|
boolean |
getStroked()
Defines whether the path will be stroked.
|
byte[] |
getStrokeImageBytes() |
double |
getStrokeTransparency() |
boolean |
getStrokeVisible() |
double |
getStrokeWeight()
Defines the brush thickness that strokes the path of a shape in points.
|
TextBox |
getTextBox()
Defines attributes that specify how text is displayed in a shape.
|
int |
getTextboxLayoutFlow_ITextBox() |
int |
getTextBoxWrapMode_ITextBox() |
TextPath |
getTextPath()
Defines the text of the text path (of a WordArt object).
|
double |
getWeight() |
boolean |
hasChart()
Returns true if this Shape has a
getChart(). |
boolean |
hasImage()
Returns true if the shape has image bytes or links an image.
|
boolean |
hasSmartArt()
Returns true if this Shape has a SmartArt object.
|
boolean |
hasVerticalTextFlow_ITextBox() |
void |
setDashStyle(int value) |
void |
setEndArrowLength(int value) |
void |
setEndArrowType(int value) |
void |
setEndArrowWidth(int value) |
void |
setEndCap(int value) |
void |
setFillColor(java.awt.Color value)
Defines the brush color that fills the closed path of the shape.
|
void |
setFilled(boolean value)
Determines whether the closed path of the shape will be filled.
|
void |
setJoinStyle(int value) |
void |
setLineFillType(int value) |
void |
setLineStyle(int value) |
void |
setStartArrowLength(int value) |
void |
setStartArrowType(int value) |
void |
setStartArrowWidth(int value) |
void |
setStrokeColor(java.awt.Color value)
Defines the color of a stroke.
|
void |
setStroked(boolean value)
Defines whether the path will be stroked.
|
void |
setStrokeTransparency(double value) |
void |
setStrokeVisible(boolean value) |
void |
setStrokeWeight(double value)
Defines the brush thickness that strokes the path of a shape in points.
|
void |
setWeight(double value) |
void |
updateSmartArtDrawing()
Updates SmartArt pre-rendered drawing by using Aspose.Words's SmartArt cold rendering engine.
|
adjustWithEffects, canHaveImage, clearRunAttrs, fetchInheritedRunAttr, fetchInheritedShapeAttr, fetchShapeAttr, getAllowOverlap, getAlternativeText, getAnchorLocked, getAspectRatioLocked, getBehindText, getBottom, getBounds, getBoundsInPoints, getBoundsWithEffects, getCoordOrigin, getCoordSize, getDirectRunAttr, getDirectShapeAttr, getDistanceBottom, getDistanceLeft, getDistanceRight, getDistanceTop, getDocument_IInline, getFill, getFillableBackColor, getFillableForeColor, getFillableImageBytes, getFillableTransparency, getFillableVisible, getFilledColor, getFillType, getFlipOrientation, getFont, getGradientAngle, getGradientStops, getGradientStyle, getGradientVariant, getHeight, getHorizontalAlignment, getHRef, getLeft, getMarkupLanguage, getName, getOn, getOpacity, getParentParagraph_IInline, getParentParagraph, getPatternType, getPresetTexture, getRelativeHorizontalPosition, getRelativeVerticalPosition, getRight, getRotateWithObject, getRotation, getScreenTip, getShadowFormat, getShapeRenderer, getShapeType, getSizeInPoints, getTarget, getTextureAlignment, getTitle, getTop, getVerticalAlignment, getWidth, getWrapSide, getWrapType, getZOrder_IShape, getZOrder, isDecorative, isDecorative, isDeleteRevision, isGroup, isHorizontalRule, isImage, isInline, isInsertRevision, isLayoutInCell, isLayoutInCell, isMoveFromRevision, isMoveToRevision, isSignatureLine, isTopLevel, isWordArt, localToParent, oneColorGradient, patterned, presetTextured, removeMoveRevisions, removeRunAttr, removeShapeAttr, setAllowOverlap, setAlternativeText, setAnchorLocked, setAspectRatioLocked, setBehindText, setBounds, setCoordOrigin, setCoordSize, setDistanceBottom, setDistanceLeft, setDistanceRight, setDistanceTop, setFillableBackColor, setFillableForeColor, setFillableTransparency, setFillableVisible, setFilledColor, setFlipOrientation, setGradientAngle, setHeight, setHorizontalAlignment, setHRef, setImage, setLeft, setName, setOn, setOpacity, setRelativeHorizontalPosition, setRelativeVerticalPosition, setRotateWithObject, setRotation, setRunAttr, setScreenTip, setShapeAttr, setTarget, setTextureAlignment, setTitle, setTop, setVerticalAlignment, setWidth, setWrapSide, setWrapType, setZOrder_IShape, setZOrder, solid, twoColorGradientacceptChildren, acceptCore, appendChild, coreRemoveSelfOnly, getChild, getChildNodes, getChildNodes, getContainer, getCount, getCurrentNode, getFirstChild, getLastChild, getNextMatchingNode, getText, hasChildNodes, indexOf, insertAfter, insertBefore, isComposite, iterator, prependChild, removeAllChildren, removeChild, removeSmartTags, selectNodes, selectSingleNodedd, deepClone, getAncestor, getAncestor, getCustomNodeId, getDocument, getNextSibling, getParentNode, getPreviousSibling, getRange, memberwiseClone, nextPreOrder, nodeTypeToString, previousPreOrder, remove, setCustomNodeId, toString, toString, toString, visitorActionToBoolpublic Shape(DocumentBase doc, int shapeType)
public final boolean accept(DocumentVisitor visitor) throws java.lang.Exception
Enumerates over this node and all of its children. Each node calls a corresponding method on DocumentVisitor.
For more info see the Visitor design pattern.
public final float getHorizontalMargins_ITextBox()
public final boolean getStrokeVisible()
public final void setStrokeVisible(boolean value)
public final double getStrokeTransparency()
public final void setStrokeTransparency(double value)
public final double getWeight()
public final void setWeight(double value)
public final int getDashStyle()
public final void setDashStyle(int value)
public final int getJoinStyle()
public final void setJoinStyle(int value)
public final int getEndCap()
public final void setEndCap(int value)
public final int getLineStyle()
public final void setLineStyle(int value)
public final int getStartArrowType()
public final void setStartArrowType(int value)
public final int getEndArrowType()
public final void setEndArrowType(int value)
public final int getStartArrowWidth()
public final void setStartArrowWidth(int value)
public final int getStartArrowLength()
public final void setStartArrowLength(int value)
public final int getEndArrowWidth()
public final void setEndArrowWidth(int value)
public final int getEndArrowLength()
public final void setEndArrowLength(int value)
public final int getLineFillType()
public final void setLineFillType(int value)
public final byte[] getStrokeImageBytes()
throws java.lang.Exception
java.lang.Exceptionpublic final int getNodeType()
NodeType.SHAPE.getNodeType in class NodeNodeType.SHAPE. The returned value is one of NodeType constants.public final int getStoryType()
StoryType.TEXTBOX.StoryType.TEXTBOX. The returned value is one of StoryType constants.public final boolean getExtrusionEnabled()
public final boolean getShadowEnabled()
public final Stroke getStroke()
Stroke value.public final boolean getStroked()
This is a shortcut to the Stroke.getOn() / Stroke.setOn(boolean) property.
The default value is true.
boolean value.public final void setStroked(boolean value)
This is a shortcut to the Stroke.getOn() / Stroke.setOn(boolean) property.
The default value is true.
value - The corresponding boolean value.public final double getStrokeWeight()
This is a shortcut to the Stroke.getWeight() / Stroke.setWeight(double) property.
The default value is 0.75.
double value.public final void setStrokeWeight(double value)
This is a shortcut to the Stroke.getWeight() / Stroke.setWeight(double) property.
The default value is 0.75.
value - The corresponding double value.public final java.awt.Color getStrokeColor()
This is a shortcut to the Stroke.getColor() / Stroke.setColor(java.awt.Color) property.
The default value is .
Color value.public final void setStrokeColor(java.awt.Color value)
This is a shortcut to the Stroke.getColor() / Stroke.setColor(java.awt.Color) property.
The default value is .
value - The corresponding Color value.public final boolean getFilled()
This is a shortcut to the Fill.getOn() / Fill.setOn(boolean) property.
The default value is true.
boolean value.public final void setFilled(boolean value)
This is a shortcut to the Fill.getOn() / Fill.setOn(boolean) property.
The default value is true.
value - The corresponding boolean value.public final java.awt.Color getFillColor()
This is a shortcut to the Fill.getColor() / Fill.setColor(java.awt.Color) property.
The default value is .
Color value.public final void setFillColor(java.awt.Color value)
This is a shortcut to the Fill.getColor() / Fill.setColor(java.awt.Color) property.
The default value is .
value - The corresponding Color value.public final boolean hasImage()
throws java.lang.Exception
java.lang.Exceptionpublic final ImageData getImageData()
ImageData value.public final OleFormat getOleFormat()
OleFormat value.public final TextBox getTextBox()
TextBox value.public final TextPath getTextPath()
TextPath value.public final Paragraph getFirstParagraph()
public final Paragraph getLastParagraph()
public final HorizontalRuleFormat getHorizontalRuleFormat()
HorizontalRuleFormat value.public final SignatureLine getSignatureLine()
getSignatureLine() object if the shape is a signature line. Returns null otherwise.
You can insert new SignatureLines into the document using DocumentBuilder.insertSignatureLine(com.aspose.words.SignatureLineOptions) and M:Aspose.Words.DocumentBuilder.InsertSignatureLine(Aspose.Words.SignatureLineOptions,Aspose.Words.Drawing.RelativeHorizontalPosition,System.Double,Aspose.Words.Drawing.RelativeVerticalPosition,System.Double,Aspose.Words.Drawing.WrapType)getSignatureLine() object if the shape is a signature line.public final int getTextBoxWrapMode_ITextBox()
public final int getTextboxLayoutFlow_ITextBox()
public final boolean hasVerticalTextFlow_ITextBox()
public final byte getMarkupLanguage_ITextBox()
public final boolean hasChart()
getChart().getChart().public final boolean hasSmartArt()
public final void updateSmartArtDrawing()
throws java.lang.Exception
java.lang.Exceptionpublic final Chart getChart()
getChart() object only if hasChart() property is true for this Shape, and will throw an exception otherwise.Chart value.