Example:
# Create a new Workbook. workbook = Workbook() # Get the first worksheet in the workbook. sheet = workbook.getWorksheets().get(0) # Add a new label to the worksheet. label = sheet.getShapes().addShape(MsoDrawingType.LABEL, 2, 0, 2, 0, 60, 120) # Set the caption of the label. label.setText("This is a Label") # Set the Placement Type, the way the # label is attached to the cells. label.setPlacement(PlacementType.FREE_FLOATING) # Set the fill color of the label. label.getFillFormat().setForeColor(Color.getYellow()) # Saves the file. workbook.save("Book1.xls")
Property Getters/Setters Summary | ||
---|---|---|
method | getActualLowerRightRow() | |
Get the actual bottom row.
|
||
method | getAlternativeText() | |
method | setAlternativeText(value) | |
Returns or sets the descriptive (alternative) text string of the |
||
method | getAnchorType() | |
method | setAnchorType(value) | |
Gets and set the type of the shape anchor placeholder. The value of the property is ShapeAnchorType integer constant. | ||
method | getAutoShapeType() | |
method | setAutoShapeType(value) | |
Gets and sets the auto shape type. The value of the property is AutoShapeType integer constant. | ||
method | getBottom() | |
method | setBottom(value) | |
Represents the width of the shape's vertical offset from its lower bottom corner row, in unit of pixels. | ||
method | getControlData() | |
Gets the data of control.
|
||
method | getCreateId() | |
method | setCreateId(value) | |
Gets and sets create id for this shape. | ||
method | getFill() | |
Returns a |
||
method | getFillFormat() | |
Returns a MsoFillFormat object that contains fill formatting properties for the specified shape.
|
||
method | getFont() | |
method | setFont(value) | |
Represents the font of shape. | ||
method | getFormatPicture() | |
Gets and sets the options of the picture format.
|
||
method | getGeometry() | |
Gets the geometry
|
||
method | getGlow() | |
Represents a |
||
method | getGroup() | |
Gets the group shape which contains this shape.
|
||
method | hasLine() | |
method | setHasLine(value) | |
Gets and sets the line border of the shape is visible. | ||
method | getHeight() | |
method | setHeight(value) | |
Represents the height of shape, in unit of pixel. | ||
method | getHeightCM() | |
method | setHeightCM(value) | |
Represents the height of the shape, in unit of centimeters. | ||
method | getHeightInch() | |
method | setHeightInch(value) | |
Represents the height of the shape, in unit of inches. | ||
method | getHeightInShape() | |
method | setHeightInShape(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.. | ||
method | getHeightPt() | |
method | setHeightPt(value) | |
Represents the height of the shape, in unit of points. | ||
method | getHeightScale() | |
method | setHeightScale(value) | |
Gets and 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; | ||
method | getHtmlText() | |
method | setHtmlText(value) | |
Gets and sets the html string which contains data and some formats in this textbox. | ||
method | getHyperlink() | |
Gets the hyperlink of the shape.
|
||
method | getId() | |
Gets the identifier of this shape.
|
||
method | getInputRange() | |
method | setInputRange(value) | |
Gets or sets the worksheet range used to fill the specified combo box. | ||
method | isAspectRatioLocked() | |
method | setAspectRatioLocked(value) | |
True means that aspect ratio of the shape is locked. | ||
method | isEquation() | |
Indicates whether the shape only contains an equation.
|
||
method | isFilled() | |
method | setFilled(value) | |
Indicates whether the fill format is visible. | ||
method | isFlippedHorizontally() | |
method | setFlippedHorizontally(value) | |
Gets and sets whether shape is horizontally flipped . | ||
method | isFlippedVertically() | |
method | setFlippedVertically(value) | |
Gets and sets whether shape is vertically flipped . | ||
method | isGroup() | |
Indicates whether this shape is a group shape.
|
||
method | isHidden() | |
method | setHidden(value) | |
Indicates whether the object is visible. | ||
method | isInGroup() | |
Indicates whether the shape is grouped.
|
||
method | isLockAspectRatio() | |
method | setLockAspectRatio(value) | |
True means that aspect ratio of the shape is locked. | ||
method | isLocked() | |
method | setLocked(value) | |
True means the object can not be modified when the sheet is protected. Note that this value is meaningful only if the worksheet or objects in the worksheet are protected. | ||
method | isPrintable() | |
method | setPrintable(value) | |
Indicates whether the object is printable. If False, this shape will not be printed when printing. | ||
method | isRichText() | |
Whether or not the text is rich text.
|
||
method | isSmartArt() | |
Indicates whether the shape is a smart art.
|
||
method | isTextWrapped() | |
method | setTextWrapped(value) | |
Gets and sets the text wrapped type of the shape which contains text. | ||
method | isWordArt() | |
Indicates whether this shape is a word art.
|
||
method | getLeft() | |
method | setLeft(value) | |
Represents the horizontal offset of shape from its left column, in unit of pixels. | ||
method | getLeftCM() | |
method | setLeftCM(value) | |
Represents the horizontal offset of shape from its left column, in unit of centimeters. | ||
method | getLeftInch() | |
method | setLeftInch(value) | |
Represents the horizontal offset of shape from its left column, in unit of inches. | ||
method | getLeftInShape() | |
method | setLeftInShape(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. | ||
method | getLeftToCorner() | |
method | setLeftToCorner(value) | |
Gets and sets the horizonal offset of shape from worksheet left border. | ||
method | getLine() | |
Gets line style
|
||
method | getLineFormat() | |
Returns a MsoLineFormat object that contains line formatting properties for the specified shape.
|
||
method | getLinkedCell() | |
method | setLinkedCell(value) | |
Gets or sets the worksheet range linked to the control's value. | ||
method | getLowerDeltaX() | |
method | setLowerDeltaX(value) | |
Gets or sets the shape's horizontal offset from its lower right corner column. | ||
method | getLowerDeltaY() | |
method | setLowerDeltaY(value) | |
Gets or sets the shape's vertical offset from its lower right corner row. | ||
method | getLowerRightColumn() | |
method | setLowerRightColumn(value) | |
Represents lower right corner column index. | ||
method | getLowerRightRow() | |
method | setLowerRightRow(value) | |
Represents lower right corner row index. | ||
method | getMacroName() | |
method | setMacroName(value) | |
Gets and sets the name of macro. | ||
method | getMsoDrawingType() | |
Gets drawing type.
The value of the property is MsoDrawingType integer constant. |
||
method | getName() | |
method | setName(value) | |
Gets and sets the name of the shape. | ||
method | getPaths() | |
Gets the paths of a custom geometric shape.
|
||
method | getPlacement() | |
method | setPlacement(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. The value of the property is PlacementType integer constant. | ||
method | getReflection() | |
Represents a |
||
method | getRelativeToOriginalPictureSize() | |
method | ||
Indicates whether shape is relative to original picture size. | ||
method | getRight() | |
method | setRight(value) | |
Represents the width of the shape's horizontal offset from its lower right corner column, in unit of pixels. | ||
method | getRotationAngle() | |
method | setRotationAngle(value) | |
Gets and sets the rotation of the shape. | ||
method | getShadowEffect() | |
Represents a |
||
method | getSoftEdges() | |
method | setSoftEdges(value) | |
Gets and sets the radius of blur to apply to the edges, in unit of points. | ||
method | getSpid() | |
Specifies an optional string identifier that an application can use to identify the particular shape.
|
||
method | getSpt() | |
Specifies an optional number that an application can use to associate the particular shape with a defined shape type.
|
||
method | getText() | |
method | setText(value) | |
Gets and sets the text of this shape. | ||
method | getTextBody() | |
Gets and sets the setting of the shape's text.
|
||
method | getTextDirection() | |
method | setTextDirection(value) | |
Gets/Sets the direction of the text flow for this object. The value of the property is TextDirectionType integer constant. | ||
method | getTextEffect() | |
Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape.
Applies to Shape objects that represent WordArt.
|
||
method | getTextHorizontalAlignment() | |
method | setTextHorizontalAlignment(value) | |
Gets and sets the text horizontal alignment type of the shape. The value of the property is TextAlignmentType integer constant. | ||
method | getTextHorizontalOverflow() | |
method | setTextHorizontalOverflow(value) | |
Gets and sets the text horizontal overflow type of the shape which contains text. The value of the property is TextOverflowType integer constant. | ||
method | getTextOptions() | |
method | setTextOptions(value) | |
Represents the text options of the shape. | ||
method | getTextOrientationType() | |
method | setTextOrientationType(value) | |
Gets and sets the text orientation type of the shape. The value of the property is TextOrientationType integer constant. | ||
method | getTextShapeType() | |
method | setTextShapeType(value) | |
Gets and sets the preset text shape type. The value of the property is AutoShapeType integer constant. | ||
method | getTextVerticalAlignment() | |
method | setTextVerticalAlignment(value) | |
Gets and sets the text vertical alignment type of the shape. The value of the property is TextAlignmentType integer constant. | ||
method | getTextVerticalOverflow() | |
method | setTextVerticalOverflow(value) | |
Gets and sets the text vertical overflow type of the shape which contains text. The value of the property is TextOverflowType integer constant. | ||
method | getThreeDFormat() | |
Gets and sets 3d format of the shape.
|
||
method | getTitle() | |
method | setTitle(value) | |
Specifies the title (caption) of the current shape object. | ||
method | getTop() | |
method | setTop(value) | |
Represents the vertical offset of shape from its top row, in unit of pixels. | ||
method | getTopCM() | |
method | setTopCM(value) | |
Represents the vertical offset of shape from its top row, in unit of centimeters. | ||
method | getTopInch() | |
method | setTopInch(value) | |
Represents the vertical offset of shape from its top row, in unit of inches. | ||
method | getTopInShape() | |
method | setTopInShape(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. | ||
method | getTopToCorner() | |
method | setTopToCorner(value) | |
Gets and sets the vertical offset of shape from worksheet top border, in unit of pixels. | ||
method | getType() | |
Gets the auto shape type.
The value of the property is AutoShapeType integer constant. |
||
method | getUpperDeltaX() | |
method | setUpperDeltaX(value) | |
Gets or sets the shape's horizontal offset from its upper left corner column. | ||
method | getUpperDeltaY() | |
method | setUpperDeltaY(value) | |
Gets or sets the shape's vertical offset from its upper left corner row. | ||
method | getUpperLeftColumn() | |
method | setUpperLeftColumn(value) | |
Represents upper left corner column index. | ||
method | getUpperLeftRow() | |
method | setUpperLeftRow(value) | |
Represents the top row index. | ||
method | getWidth() | |
method | setWidth(value) | |
Represents the width of shape, in unit of pixels. | ||
method | getWidthCM() | |
method | setWidthCM(value) | |
Represents the width of the shape, in unit of centimeters. | ||
method | getWidthInch() | |
method | setWidthInch(value) | |
Represents the width of the shape, in unit of inch. | ||
method | getWidthInShape() | |
method | setWidthInShape(value) | |
Represents the width of the shape, in unit of 1/4000 of the parent shape. | ||
method | getWidthPt() | |
method | setWidthPt(value) | |
Represents the width of the shape, in unit of point. | ||
method | getWidthScale() | |
method | setWidthScale(value) | |
Gets and 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; | ||
method | getWorksheet() | |
Gets the |
||
method | getX() | |
method | setX(value) | |
Gets and sets the horizontal offset of shape from worksheet left border,in unit of pixels. | ||
method | getY() | |
method | setY(value) | |
Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels. | ||
method | getZOrderPosition() | |
method | setZOrderPosition(value) | |
Returns the position of a shape in the z-order. |
Method Summary | ||
---|---|---|
method | addHyperlink(address) | |
Adds a hyperlink to the shape.
|
||
method | alignTopRightCorner(topRow, rightColumn) | |
Moves the picture to the top-right corner.
|
||
method | calculateTextSize() | |
Recalculate the text area
|
||
method | characters(startIndex, length) | |
Returns a Characters object that represents a range of characters within the text.
|
||
method | formatCharacters(startIndex, length, font, flag) | |
Formats some characters with the font setting.
|
||
method | getActualBox() | |
Get the actual position and size of the shape (after applying rotation, flip, etc.)
|
||
method | getCharacters() | |
Returns all Characters objects
that represents a range of characters within the text .
|
||
method | getConnectionPoints() | |
Get the connection points
|
||
method | getInputRange(isR1C1, isLocal) | |
Gets the range used to fill the control.
|
||
method | getLinkedCell(isR1C1, isLocal) | |
Gets the range linked to the control's value.
|
||
method | getLockedProperty(type) | |
Gets the value of locked property.
|
||
method | getResultOfSmartArt() | |
Converting smart art to grouped shapes.
|
||
method | getRichFormattings() | |
Returns all Characters objects
that represents a range of characters within the text .
|
||
method | isSameSetting(obj) | |
Returns whether the shape is same.
|
||
method | moveToRange(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn) | |
Moves the shape to a specified range.
|
||
method | removeActiveXControl() | |
Remove activeX control.
|
||
method | removeHyperlink() | |
Removes the hyperlink of the shape.
|
||
method | setInputRange(formula, isR1C1, isLocal) | |
Sets the range used to fill the control.
|
||
method | setLinkedCell(formula, isR1C1, isLocal) | |
Sets the range linked to the control's value.
|
||
method | setLockedProperty(type, value) | |
Set the locked property.
|
||
method | toFrontOrBack(orders) | |
Brings the shape to the front or sends the shape to back.
|
||
method | toImage(imageFile, options) | |
Saves the shape to a file.
|
||
method | updateSelectedValue() | |
Update the selected value by the value of the linked cell.
|
String getMacroName() / setMacroName(value)
boolean isEquation()
boolean isSmartArt()
int getZOrderPosition() / setZOrderPosition(value)
String getName() / setName(value)
String getAlternativeText() / setAlternativeText(value)
String getTitle() / setTitle(value)
MsoLineFormat getLineFormat()
MsoFillFormat getFillFormat()
LineFormat getLine()
FillFormat getFill()
ShadowEffect getShadowEffect()
ReflectionEffect getReflection()
GlowEffect getGlow()
float getSoftEdges() / setSoftEdges(value)
ThreeDFormat getThreeDFormat()
MsoFormatPicture getFormatPicture()
boolean isHidden() / setHidden(value)
boolean isLockAspectRatio() / setLockAspectRatio(value)
boolean isAspectRatioLocked() / setAspectRatioLocked(value)
float getRotationAngle() / setRotationAngle(value)
int getId()
String getSpid()
int getSpt()
Worksheet getWorksheet()
boolean isGroup()
boolean isInGroup()
boolean isWordArt()
TextEffectFormat getTextEffect()
boolean isLocked() / setLocked(value)
boolean isPrintable() / setPrintable(value)
int getMsoDrawingType()
int getAutoShapeType() / setAutoShapeType(value)
int getAnchorType() / setAnchorType(value)
int getPlacement() / setPlacement(value)
int getUpperLeftRow() / setUpperLeftRow(value)
int getUpperDeltaY() / setUpperDeltaY(value)
int getUpperLeftColumn() / setUpperLeftColumn(value)
int getUpperDeltaX() / setUpperDeltaX(value)
int getLowerRightRow() / setLowerRightRow(value)
int getLowerDeltaY() / setLowerDeltaY(value)
int getLowerRightColumn() / setLowerRightColumn(value)
int getLowerDeltaX() / setLowerDeltaX(value)
int getRight() / setRight(value)
int getBottom() / setBottom(value)
int getWidth() / setWidth(value)
float getWidthInch() / setWidthInch(value)
float getWidthPt() / setWidthPt(value)
float getWidthCM() / setWidthCM(value)
int getHeight() / setHeight(value)
float getHeightInch() / setHeightInch(value)
float getHeightPt() / setHeightPt(value)
float getHeightCM() / setHeightCM(value)
int getLeft() / setLeft(value)
float getLeftInch() / setLeftInch(value)
float getLeftCM() / setLeftCM(value)
int getTop() / setTop(value)
float getTopInch() / setTopInch(value)
float getTopCM() / setTopCM(value)
int getTopToCorner() / setTopToCorner(value)
int getLeftToCorner() / setLeftToCorner(value)
int getX() / setX(value)
int getY() / setY(value)
int getWidthScale() / setWidthScale(value)
int getHeightScale() / setHeightScale(value)
int getTopInShape() / setTopInShape(value)
int getLeftInShape() / setLeftInShape(value)
int getWidthInShape() / setWidthInShape(value)
int getHeightInShape() / setHeightInShape(value)
GroupShape getGroup()
int getType()
boolean hasLine() / setHasLine(value)
boolean isFilled() / setFilled(value)
boolean isFlippedHorizontally() / setFlippedHorizontally(value)
boolean isFlippedVertically() / setFlippedVertically(value)
int getActualLowerRightRow()
boolean getRelativeToOriginalPictureSize() / setRelativeToOriginalPictureSize(value)
String getLinkedCell() / setLinkedCell(value)
String getInputRange() / setInputRange(value)
int getTextShapeType() / setTextShapeType(value)
FontSettingCollection getTextBody()
TextOptions getTextOptions() / setTextOptions(value)
String getText() / setText(value)
boolean isRichText()
String getHtmlText() / setHtmlText(value)
int getTextVerticalOverflow() / setTextVerticalOverflow(value)
int getTextHorizontalOverflow() / setTextHorizontalOverflow(value)
boolean isTextWrapped() / setTextWrapped(value)
int getTextOrientationType() / setTextOrientationType(value)
int getTextHorizontalAlignment() / setTextHorizontalAlignment(value)
int getTextVerticalAlignment() / setTextVerticalAlignment(value)
int getTextDirection() / setTextDirection(value)
byte[] getControlData()
ShapePathCollection getPaths()
UUID getCreateId() / setCreateId(value)
String getLinkedCell(isR1C1, isLocal)
isR1C1: boolean
- Whether the formula needs to be formatted as R1C1.isLocal: boolean
- Whether the formula needs to be formatted by locale.setLinkedCell(formula, isR1C1, isLocal)
formula: 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.String getInputRange(isR1C1, isLocal)
isR1C1: boolean
- Whether the formula needs to be formatted as R1C1.isLocal: boolean
- Whether the formula needs to be formatted by locale.setInputRange(formula, isR1C1, isLocal)
formula: 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.updateSelectedValue()
int[] calculateTextSize()
formatCharacters(startIndex, length, font, flag)
startIndex: int
- The start index.length: int
- The length.font: Font
- The font setting.flag: StyleFlag
- The flag of the font setting.FontSetting characters(startIndex, length)
startIndex: int
- The index of the start of the character.length: int
- The number of characters.ArrayList getCharacters()
FontSetting[] getRichFormattings()
removeActiveXControl()
boolean isSameSetting(obj)
obj: Object
- float[] getActualBox()
float[][] getConnectionPoints()
toImage(imageFile, options)
GroupShape getResultOfSmartArt()
toFrontOrBack(orders)
orders: int
-
If it's less than zero, sets the shape to back.
If it's greater than zero, brings the shape to front.
boolean getLockedProperty(type)
type: int
- A setLockedProperty(type, value)
type: int
- A value: boolean
- The value of the property.Hyperlink addHyperlink(address)
address: String
- Address of the hyperlink.removeHyperlink()
moveToRange(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn)
upperLeftRow: int
- Upper left row index.upperLeftColumn: int
- Upper left column index.lowerRightRow: int
- Lower right row indexlowerRightColumn: int
- Lower right column indexalignTopRightCorner(topRow, rightColumn)
topRow: int
- the row index.rightColumn: int
- the column index.