com.aspose.cells
Class ShapeCollection

java.lang.Object
  extended by CollectionBase
      extended by com.aspose.cells.ShapeCollection
All Implemented Interfaces:
com.aspose.cells.c.b.a.a.a.c.b.e

public class ShapeCollection 
extends CollectionBase

Represents all the shape in a worksheet/chart.

Property Getters/Setters Summary
intgetCount()→ inherited from com.aspose.cells.CollectionBase
          
Shapeget(int index)
           Gets the shape object at the specific index.
Shapeget(java.lang.String name)
           Gets the shape object by the shape image
 
Method Summary
intadd(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
ShapeaddAutoShape(int type, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)
           Adds a AutoShape to the worksheet.
ShapeaddAutoShapeInChart(int type, int top, int left, int height, int width)
           Adds a AutoShape to the chart.
ShapeaddCopy(Shape sourceShape, int upperLeftRow, int top, int upperLeftColumn, int left)
           Adds and copy a shape to the worksheet..
ShapeaddFreeFloatingShape(int type, int top, int left, int height, int width, byte[] imageData, boolean isOriginalSize)
           Adds a free floating shape to the worksheet.Only applies for line/image shape.
LabeladdLabelInChart(int top, int left, int height, int width)
           Adds a label to the chart.
PictureaddLinkedPicture(int upperLeftRow, int upperLeftColumn, int height, int width, java.lang.String sourceFullName)
           Add a linked picture.
OleObjectaddOleObject(int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width, byte[] imageData)
          
OleObjectaddOleObjectWithLinkedImage(int upperLeftRow, int upperLeftColumn, int height, int width, java.lang.String sourceFullName)
           Add a linked picture.
PictureaddPicture(int upperLeftRow, int upperLeftColumn, java.io.InputStream stream, int widthScale, int heightScale)
           Adds a picture to the collection.
PictureaddPictureInChart(int top, int left, java.io.InputStream stream, int widthScale, int heightScale)
           Adds a picture to the chart.
ShapeaddShape(int type, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)
           Adds a Shape to the worksheet.
ShapeaddShapeInChart(int type, int placement, int left, int top, int right, int bottom)
           Add a shape to chart .All unit is 1/4000 of chart area.
ShapeaddShapeInChart1(int type, int placement, int left, int top, int right, int bottom, byte[] imageData)
           Add a shape to chart .All unit is 1/4000 of chart area.
TextBoxaddTextBoxInChart(int top, int left, int height, int width)
           Adds a textbox to the chart.
ShapeaddTextEffect(int effect, java.lang.String text, java.lang.String fontName, int size, boolean fontBold, boolean fontItalic, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)
           Inserts a WordArt object.
ShapeaddTextEffectInChart(int effect, java.lang.String text, java.lang.String fontName, int size, boolean fontBold, boolean fontItalic, int top, int left, int height, int width)
           Inserts a WordArt object to the chart
voidclear()→ inherited from com.aspose.cells.CollectionBase
          
booleancontains(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
voidcopyCommentsInRange(ShapeCollection shapes, CellArea ca, int destRow, int destColumn)
           Copy all comments in the range.
voidcopyInRange(ShapeCollection sourceShapes, CellArea ca, int destRow, int destColumn, boolean isContained)
           Copy shapes in the range to destination range.
voiddeleteInRange(CellArea ca)
           Delete shapes in the range.Comment shapes will not be deleted.
voiddeleteShape(Shape shape)
           Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted.
java.lang.Objectget(int index)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
GroupShapegroup(com.aspose.cells.Shape[] groupItems)
           Group the shapes.
intindexOf(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
java.util.Iteratoriterator()→ inherited from com.aspose.cells.CollectionBase
          
voidremove(Shape shape)
           Remove the shape.
voidremoveAt(int index)
           Remove the shape.
voidungroup(GroupShape group)
           Ungroups the shape items.
voidupdateSelectedValue()
           Update the selected value by the value of the linked cell of the shapes.
 

Property Getters/Setters Detail

getCount

→ inherited from com.aspose.cells.CollectionBase
public int getCount()

get

public Shape get(int index)
Gets the shape object at the specific index.
Parameters:
index -
Returns:

get

public Shape get(java.lang.String name)
Gets the shape object by the shape image
Parameters:
name -
Returns:

Method Detail

addCopy

public Shape addCopy(Shape sourceShape, int upperLeftRow, int top, int upperLeftColumn, int left)
Adds and copy a shape to the worksheet..
Parameters:
sourceShape - Source shape.
upperLeftRow - Upper left row index.
top - Represents the vertical offset of checkbox from its left row, in unit of pixel.
upperLeftColumn - Upper left column index.
left - Represents the horizontal offset of textbox from its left column, in unit of pixel.
Returns:
The new shape object index.

addLabelInChart

public Label addLabelInChart(int top, int left, int height, int width)
Adds a label to the chart.
Parameters:
top - Represents the vertical offset of label from the upper left corner in units of 1/4000 of the chart area.
left - Represents the vertical offset of label from the upper left corner in units of 1/4000 of the chart area.
height - Represents the height of label, in units of 1/4000 of the chart area.
width - Represents the width of label, in units of 1/4000 of the chart area.
Returns:
A new Label object.

addTextBoxInChart

public TextBox addTextBoxInChart(int top, int left, int height, int width)
Adds a textbox to the chart.
Parameters:
top - Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
left - Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
height - Represents the height of textbox, in units of 1/4000 of the chart area.
width - Represents the width of textbox, in units of 1/4000 of the chart area.
Returns:
A TextBox object.

addTextEffectInChart

public Shape addTextEffectInChart(int effect, java.lang.String text, java.lang.String fontName, int size, boolean fontBold, boolean fontItalic, int top, int left, int height, int width)
Inserts a WordArt object to the chart
Parameters:
effect - A MsoPresetTextEffect value. The mso preset text effect type.
text - The WordArt text.
fontName - The font name.
size - The font size
fontBold - Indicates whether font is bold.
fontItalic - Indicates whether font is italic.
top - Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
left - Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
height - Represents the height of shape, in units of 1/4000 of the chart area.
width - Represents the width of shape, in units of 1/4000 of the chart area.
Returns:
Returns a Shape object that represents the new WordArt object.

addTextEffect

public Shape addTextEffect(int effect, java.lang.String text, java.lang.String fontName, int size, boolean fontBold, boolean fontItalic, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)
Inserts a WordArt object.
Parameters:
effect - A MsoPresetTextEffect value. The mso preset text effect type.
text - The WordArt text.
fontName - The font name.
size - The font size
fontBold - Indicates whether font is bold.
fontItalic - Indicates whether font is italic.
upperLeftRow - Upper left row index.
top - Represents the vertical offset of shape from its left row, in unit of pixel.
upperLeftColumn - Upper left column index.
left - Represents the horizontal offset of shape from its left column, in unit of pixel.
height - Represents the height of shape, in unit of pixel.
width - Represents the width of shape, in unit of pixel.
Returns:
Returns a Shape object that represents the new WordArt object.

addFreeFloatingShape

public Shape addFreeFloatingShape(int type, int top, int left, int height, int width, byte[] imageData, boolean isOriginalSize)
                          throws java.lang.Exception
Adds a free floating shape to the worksheet.Only applies for line/image shape.
Parameters:
type - A MsoDrawingType value. The shape type.
top - Represents the vertical offset of shape from the worksheet's top row, in unit of pixel.
left - Represents the horizontal offset of shape from the worksheet's left column, in unit of pixel.
height - Represents the height of LineShape, in unit of pixel.
width - Represents the width of LineShape, in unit of pixel.
imageData - The image data,only applies for the picture.
isOriginalSize - Whether the shape use original size if the shape is image.
Returns:

addShapeInChart1

public Shape addShapeInChart1(int type, int placement, int left, int top, int right, int bottom, byte[] imageData)
                      throws java.lang.Exception
Add a shape to chart .All unit is 1/4000 of chart area.
Parameters:
type - A MsoDrawingType value. The drawing type.
placement - A PlacementType value. the placement type.
left - In unit of 1/4000 chart area width.
top - In unit of 1/4000 chart area height.
right - In unit of 1/4000 chart area width.
bottom - In unit of 1/4000 chart area height.
imageData - If the shape is not a picture or ole object,imageData should be null.

addShapeInChart

public Shape addShapeInChart(int type, int placement, int left, int top, int right, int bottom)
Add a shape to chart .All unit is 1/4000 of chart area.
Parameters:
type - A MsoDrawingType value. The drawing type.
placement - A PlacementType value. the placement type.
left - In unit of 1/4000 chart area width.
top - In unit of 1/4000 chart area height.
right - In unit of 1/4000 chart area width.
bottom - In unit of 1/4000 chart area height.

addShape

public Shape addShape(int type, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)
Adds a Shape to the worksheet. The type could not be Chart/Comment/Picuter/OleObject/Polygon/DialogBox
Parameters:
type - A MsoDrawingType value. Mso drawing type.
upperLeftRow - Upper left row index.
top - Represents the vertical offset of Shape from its left row, in unit of pixel.
upperLeftColumn - Upper left column index.
left - Represents the horizontal offset of Shape from its left column, in unit of pixel.
height - Represents the height of Shape, in unit of pixel.
width - Represents the width of Shape, in unit of pixel.
Returns:
A Shape object.

addAutoShape

public Shape addAutoShape(int type, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)
Adds a AutoShape to the worksheet. The type could not be Chart/Comment/Picuter/OleObject/Polygon/DialogBox
Parameters:
type - A AutoShapeType value. Auto shape type.
upperLeftRow - Upper left row index.
top - Represents the vertical offset of Shape from its left row, in unit of pixel.
upperLeftColumn - Upper left column index.
left - Represents the horizontal offset of Shape from its left column, in unit of pixel.
height - Represents the height of Shape, in unit of pixel.
width - Represents the width of Shape, in unit of pixel.
Returns:
A Shape object.

addAutoShapeInChart

public Shape addAutoShapeInChart(int type, int top, int left, int height, int width)
Adds a AutoShape to the chart. The type could not be Chart/Comment/Picuter/OleObject/Polygon/DialogBox
Parameters:
type - A AutoShapeType value. Auto shape type.
top - Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
left - Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
height - Represents the height of textbox, in units of 1/4000 of the chart area.
width - Represents the width of textbox, in units of 1/4000 of the chart area.
Returns:
Returns a shape objct.

addPicture

public Picture addPicture(int upperLeftRow, int upperLeftColumn, java.io.InputStream stream, int widthScale, int heightScale)
                  throws java.lang.Exception
Adds a picture to the collection.
Parameters:
upperLeftRow - Upper left row index.
upperLeftColumn - Upper left column index.
stream - Stream object which contains the image data.
widthScale - Scale of image width, a percentage.
heightScale - Scale of image width, a percentage.
Returns:
Picture Picture object.

addLinkedPicture

public Picture addLinkedPicture(int upperLeftRow, int upperLeftColumn, int height, int width, java.lang.String sourceFullName)
Add a linked picture.
Parameters:
upperLeftRow - Upper left row index.
upperLeftColumn - Upper left column index.
height - The height of the shape. In unit of pixels
width - The width of the shape. In unit of pixels
sourceFullName - The path and name of the source file for the linked image
Returns:
Picture Picture object.

addOleObjectWithLinkedImage

public OleObject addOleObjectWithLinkedImage(int upperLeftRow, int upperLeftColumn, int height, int width, java.lang.String sourceFullName)
Add a linked picture.
Parameters:
upperLeftRow - Upper left row index.
upperLeftColumn - Upper left column index.
height - The height of the shape. In unit of pixels
width - The width of the shape. In unit of pixels
sourceFullName - The path and name of the source file for the linked image
Returns:
Picture Picture object.

addPictureInChart

public Picture addPictureInChart(int top, int left, java.io.InputStream stream, int widthScale, int heightScale)
                         throws java.lang.Exception
Adds a picture to the chart.
Parameters:
top - Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
left - Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
stream - Stream object which contains the image data.
widthScale - Scale of image width, a percentage.
heightScale - Scale of image width, a percentage.
Returns:
Returns a Picture objct.

addOleObject

public OleObject addOleObject(int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width, byte[] imageData)
                      throws java.lang.Exception
Parameters:
upperLeftRow -
top -
upperLeftColumn -
left -
height -
width -
imageData -
Returns:

copyCommentsInRange

public void copyCommentsInRange(ShapeCollection shapes, CellArea ca, int destRow, int destColumn)
Copy all comments in the range.
Parameters:
shapes - The source shapes.
ca - The source range.
destRow - The dest range start row.
destColumn - The dest range start column.

copyInRange

public void copyInRange(ShapeCollection sourceShapes, CellArea ca, int destRow, int destColumn, boolean isContained)
Copy shapes in the range to destination range.
Parameters:
sourceShapes - Source shapes.
ca - The source range.
destRow - The dest row index of the dest range.
destColumn - The dest column of the dest range.
isContained - Whether only copy the shapes which are contained in the range. If true,only copies the shapes in the range. Otherwise,it works as MS Office.

deleteInRange

public void deleteInRange(CellArea ca)
Delete shapes in the range.Comment shapes will not be deleted.
Parameters:
ca - The range.If the shapes are contained in the range, they will be removed.

deleteShape

public void deleteShape(Shape shape)
Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted.
Parameters:
shape -

group

public GroupShape group(com.aspose.cells.Shape[] groupItems)
Group the shapes. The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.
Parameters:
groupItems - the group items.
Returns:
Return the group shape.

ungroup

public void ungroup(GroupShape group)
Ungroups the shape items. If the group shape is grouped by another group shape,nothing will be done.
Parameters:
group - The group shape.

removeAt

public void removeAt(int index)
Remove the shape.
Parameters:
index - The index of the shape.

remove

public void remove(Shape shape)
Remove the shape.
Parameters:
shape -

updateSelectedValue

public void updateSelectedValue()
                        throws java.lang.Exception
Update the selected value by the value of the linked cell of the shapes.

clear

→ inherited from com.aspose.cells.CollectionBase
public void clear()

iterator

→ inherited from com.aspose.cells.CollectionBase
public java.util.Iterator iterator()

get

→ inherited from com.aspose.cells.CollectionBase
public java.lang.Object get(int index)
Reserved for internal use.

contains

→ inherited from com.aspose.cells.CollectionBase
public boolean contains(java.lang.Object value)
Reserved for internal use.

add

→ inherited from com.aspose.cells.CollectionBase
public int add(java.lang.Object value)
Reserved for internal use.

indexOf

→ inherited from com.aspose.cells.CollectionBase
public int indexOf(java.lang.Object value)
Reserved for internal use.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.