aspose.cells

Class ShapeCollection

Represents all the shape in a worksheet/chart.

Property Getters/Setters Summary
functiongetCount()
functionget(index)
Gets the shape object at the specific index.
functionget(name)
Gets the shape object by the shape image
 
Method Summary
functionaddAutoShape(type, upperLeftRow, top, upperLeftColumn, left, height, width)
Adds a AutoShape to the worksheet.
functionaddAutoShapeInChart(type, top, left, height, width)
Adds a AutoShape to the chart.
functionaddCopy(sourceShape, upperLeftRow, top, upperLeftColumn, left)
Adds and copy a shape to the worksheet..
functionaddFreeFloatingShape(type, top, left, height, width, imageData, isOriginalSize)
Adds a free floating shape to the worksheet.Only applies for line/image shape.
functionaddLabelInChart(top, left, height, width)
Adds a label to the chart.
functionaddLinkedPicture(upperLeftRow, upperLeftColumn, height, width, sourceFullName)
Add a linked picture.
functionaddOleObject(upperLeftRow, top, upperLeftColumn, left, height, width, imageData)
functionaddOleObjectWithLinkedImage(upperLeftRow, upperLeftColumn, height, width, sourceFullName)
Add a linked picture.
functionaddShape(type, upperLeftRow, top, upperLeftColumn, left, height, width)
Adds a Shape to the worksheet.
functionaddShapeInChart(type, placement, left, top, right, bottom)
Add a shape to chart .All unit is 1/4000 of chart area.
functionaddShapeInChart(type, placement, left, top, right, bottom, imageData)
Add a shape to chart .All unit is 1/4000 of chart area.
functionaddTextBoxInChart(top, left, height, width)
Adds a textbox to the chart.
functionaddTextEffect(effect, text, fontName, size, fontBold, fontItalic, upperLeftRow, top, upperLeftColumn, left, height, width)
Inserts a WordArt object.
functionaddTextEffectInChart(effect, text, fontName, size, fontBold, fontItalic, top, left, height, width)
Inserts a WordArt object to the chart
functionaddWordArt(style, text, upperLeftRow, top, upperLeftColumn, left, height, width)
Adds preset WordArt since Excel 2007.s
functionclear()
Clear all shapes.
functioncontains(value)
Reserved for internal use.
functioncopyCommentsInRange(shapes, ca, destRow, destColumn)
Copy all comments in the range.
functioncopyInRange(sourceShapes, ca, destRow, destColumn, isContained)
Copy shapes in the range to destination range.
functiondeleteInRange(ca)
Delete shapes in the range.Comment shapes will not be deleted.
functiondeleteShape(shape)
Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted.
functionget(index)
Reserved for internal use.
functiongroup(groupItems)
Group the shapes.
functionindexOf(value)
Reserved for internal use.
functioniterator()
functionremove(shape)
Remove the shape.
functionremoveAt(index)
Remove the shape.
functionungroup(group)
Ungroups the shape items.
functionupdateSelectedValue()
Update the selected value by the value of the linked cell of the shapes.
 

    • Property Getters/Setters Detail

      • getCount : Number 

        function getCount()
        
      • get : Shape 

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

        function get(name)
        
        Gets the shape object by the shape image
        Parameters:
        name -
        Returns:
    • Method Detail

      • addCopy

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

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

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

        function addTextEffectInChart(effect, text, fontName, size, fontBold, fontItalic, top, left, height, width)
        Inserts a WordArt object to the chart
        Parameters:
        effect: Number - A MsoPresetTextEffect value. The mso preset text effect type.
        text: String - The WordArt text.
        fontName: String - The font name.
        size: Number - The font size
        fontBold: boolean - Indicates whether font is bold.
        fontItalic: boolean - Indicates whether font is italic.
        top: Number - Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
        left: Number - Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
        height: Number - Represents the height of shape, in units of 1/4000 of the chart area.
        width: Number - 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

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

        function addWordArt(style, text, upperLeftRow, top, upperLeftColumn, left, height, width)
        Adds preset WordArt since Excel 2007.s
        Parameters:
        style: Number - A PresetWordArtStyle value. The preset WordArt Style.
        text: String - The text.
        upperLeftRow: Number - Upper left row index.
        top: Number - Represents the vertical offset of shape from its left row, in unit of pixel.
        upperLeftColumn: Number - Upper left column index.
        left: Number - Represents the horizontal offset of shape from its left column, in unit of pixel.
        height: Number - Represents the height of shape, in unit of pixel.
        width: Number - Represents the width of shape, in unit of pixel.
        Returns:
      • addFreeFloatingShape

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

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

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

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

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

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

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

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

        function addOleObject(upperLeftRow, top, upperLeftColumn, left, height, width, imageData)
        Parameters:
        upperLeftRow: Number -
        top: Number -
        upperLeftColumn: Number -
        left: Number -
        height: Number -
        width: Number -
        imageData: byte[] -
        Returns:
      • copyCommentsInRange

        function copyCommentsInRange(shapes, ca, destRow, destColumn)
        Copy all comments in the range.
        Parameters:
        shapes: ShapeCollection - The source shapes.
        ca: CellArea - The source range.
        destRow: Number - The dest range start row.
        destColumn: Number - The dest range start column.
      • copyInRange

        function copyInRange(sourceShapes, ca, destRow, destColumn, isContained)
        Copy shapes in the range to destination range.
        Parameters:
        sourceShapes: ShapeCollection - Source shapes.
        ca: CellArea - The source range.
        destRow: Number - The dest row index of the dest range.
        destColumn: Number - The dest column of the dest range.
        isContained: boolean - 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

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

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

        function group(groupItems)
        Group the shapes. The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.
        Parameters:
        groupItems: Shape[] - the group items.
        Returns:
        Return the group shape.
      • ungroup

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

        function removeAt(index)
        Remove the shape.
        Parameters:
        index: Number - The index of the shape.
      • remove

        function remove(shape)
        Remove the shape.
        Parameters:
        shape: Shape -
      • clear

        function clear()
        Clear all shapes.
      • updateSelectedValue

        function updateSelectedValue()
        Update the selected value by the value of the linked cell of the shapes.
      • iterator

        function iterator()
      • get

        function get(index)
        Reserved for internal use.
      • contains

        function contains(value)
        Reserved for internal use.
      • indexOf

        function indexOf(value)
        Reserved for internal use.