Example:
# Instantiate a new Workbook. workbook = Workbook() # Get the first worksheet in the book. worksheet = workbook.getWorksheets().get(0) # Add a new line to the worksheet. line1 = worksheet.getShapes().addShape(MsoDrawingType.LINE, 5, 0, 1, 0, 0, 250) # Set the line dash style line1.getLineFormat().setDashStyle(MsoLineDashStyle.SOLID) # Set the placement. line1.setPlacement(PlacementType.FREE_FLOATING) # Add another line to the worksheet. line2 = worksheet.getShapes().addShape(MsoDrawingType.LINE, 7, 0, 1, 0, 85, 250) # Set the line dash style. line2.getLineFormat().setDashStyle(MsoLineDashStyle.DASH_LONG_DASH) # Set the weight of the line. line2.getLineFormat().setWeight(4) # Set the placement. line2.setPlacement(PlacementType.FREE_FLOATING) # Add the third line to the worksheet. line3 = worksheet.getShapes().addShape(MsoDrawingType.LINE, 13, 0, 1, 0, 0, 250) # Set the line dash style line3.getLineFormat().setDashStyle(MsoLineDashStyle.SOLID) # Set the placement. line3.setPlacement(PlacementType.FREE_FLOATING) # Make the gridlines invisible in the first worksheet. workbook.getWorksheets().get(0).setGridlinesVisible(False) # Save the excel 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 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 | getBeginArrowheadLength() | |
method | setBeginArrowheadLength(value) | |
Gets and sets the begin arrow head length of the line. The value of the property is MsoArrowheadLength integer constant. | ||
method | getBeginArrowheadStyle() | |
method | setBeginArrowheadStyle(value) | |
Gets and sets the begin arrow head style of the line. The value of the property is MsoArrowheadStyle integer constant. | ||
method | getBeginArrowheadWidth() | |
method | setBeginArrowheadWidth(value) | |
Gets and sets the begin arrow head width of the line. The value of the property is MsoArrowheadWidth 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 | getConnectionPoints() | |
Get the connection points
|
||
method | getControlData() | |
Gets the data of control.
|
||
method | getEndArrowheadLength() | |
method | setEndArrowheadLength(value) | |
Gets and sets the end arrow head length of the line. The value of the property is MsoArrowheadLength integer constant. | ||
method | getEndArrowheadStyle() | |
method | setEndArrowheadStyle(value) | |
Gets and sets the end arrow head style of the line. The value of the property is MsoArrowheadStyle integer constant. | ||
method | getEndArrowheadWidth() | |
method | setEndArrowheadWidth(value) | |
Gets and sets the end arrow head width of the line. The value of the property is MsoArrowheadWidth integer constant. | ||
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 | getFormat() | |
Represents the setting of the shape's formatting.
|
||
method | getFormatPicture() | |
Gets and sets the options of the picture format.
|
||
method | getGeometry() | |
Gets the geometry
|
||
method | getGlow() | |
Represents a object that specifies glow effect for the chart element or shape.
|
||
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 | getHeightInChart() | |
method | setHeightInChart(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 | 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 | 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 the shape is a group.
|
||
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 don't allow changes in aspect ratio. | ||
method | isLocked() | |
method | setLocked(value) | |
True if the object is locked, False if the object can be modified when the sheet is protected. | ||
method | isPrintable() | |
method | setPrintable(value) | |
True if the object is printable | ||
method | isRichText() | |
Whether or not the text is rich text.
|
||
method | isSmartArt() | |
Indicates whether the shape is 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 | getLeftInChart() | |
method | setLeftInChart(value) | |
Represents the vertical offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape. | ||
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 mso 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 | getPositionX() | |
method | setPositionX(value) | |
Gets and sets the horizonal offset of shape from worksheet left border,in unit of pixels. | ||
method | getPositionY() | |
method | setPositionY(value) | |
Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels. | ||
method | getReflection() | |
Represents a object that specifies reflection effect for the chart element or shape.
|
||
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 object that specifies shadow effect for the chart element or shape.
|
||
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 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) | |
Represents the string in this TextBox object. | ||
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 | getTextFrame() | |
Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape.
|
||
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() | |
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 | getTopInChart() | |
method | setTopInChart(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 | 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 upper left corner 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 | getWidthInChart() | |
method | setWidthInChart(value) | |
Represents the width of the shape, in unit of 1/4000 of the parent shape. | ||
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) | |
Formats some characters with the font setting.
|
||
method | formatCharacters(startIndex, length, font, flag) | |
Formats some characters with the font setting.
|
||
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 | 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() | |
Remove 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.
|
int getBeginArrowheadStyle() / setBeginArrowheadStyle(value)
int getBeginArrowheadWidth() / setBeginArrowheadWidth(value)
int getBeginArrowheadLength() / setBeginArrowheadLength(value)
int getEndArrowheadStyle() / setEndArrowheadStyle(value)
int getEndArrowheadWidth() / setEndArrowheadWidth(value)
int getEndArrowheadLength() / setEndArrowheadLength(value)
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()
ShapeFormat getFormat()
LineFormat getLine()
FillFormat getFill()
ShadowEffect getShadowEffect()
ReflectionEffect getReflection()
GlowEffect getGlow()
float getSoftEdges() / setSoftEdges(value)
ThreeDFormat getThreeDFormat()
MsoTextFrame getTextFrame()
MsoFormatPicture getFormatPicture()
boolean isHidden() / setHidden(value)
boolean isLockAspectRatio() / setLockAspectRatio(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)
int getHeightInChart() / setHeightInChart(value)
int getLeftInChart() / setLeftInChart(value)
int getTopInChart() / setTopInChart(value)
int getWidthInChart() / setWidthInChart(value)
int getPositionX() / setPositionX(value)
int getPositionY() / setPositionY(value)
GroupShape getGroup()
int getType()
boolean hasLine() / setHasLine(value)
boolean isFilled() / setFilled(value)
boolean isFlippedHorizontally() / setFlippedHorizontally(value)
boolean isFlippedVertically() / setFlippedVertically(value)
int getActualLowerRightRow()
Float[] getConnectionPoints()
boolean getRelativeToOriginalPictureSize() / setRelativeToOriginalPictureSize(value)
String getLinkedCell() / setLinkedCell(value)
String getInputRange() / setInputRange(value)
int getTextShapeType() / setTextShapeType(value)
FontSettingCollection getTextBody()
TextOptions getTextOptions()
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()
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.formatCharacters(startIndex, length, font)
startIndex: int
- The start index.length: int
- The length.font: Font
- 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()
removeActiveXControl()
boolean isSameSetting(obj)
obj: Object
- 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.