ShapeCollection

ShapeCollection class

Represents all the shape in a worksheet/chart.

Properties

NameTypeDescription
Countint
Item (int)ShapeGets the Shape object at the specific index in the list.
Item (java.lang.String)ShapeGets the Shape object by the name of the shape.

Methods

NameDescription
addCopyAdds and copy a shape to the worksheet.
addCheckBoxAdds a checkbox to the worksheet.
addTextBoxAdds a text box to the worksheet.
addEquationAdd an equation object to the worksheet.
addLaTeXEquation
addSpinnerAdds a Spinner to the worksheet.
addScrollBarAdds a ScrollBar to the worksheet.
addRadioButtonAdds a RadioButton to the worksheet.
addListBoxAdds a ListBox to the worksheet.
addComboBoxAdds a ComboBox to the worksheet.
addGroupBoxAdds a GroupBox to the worksheet.
addButtonAdds a Button to the worksheet.
addLabelAdds a Label to the worksheet.
addLabelInChartAdds a label to the chart.
addTextBoxInChartAdds a textbox to the chart.
addTextEffectInChartInserts a WordArt object to the chart
addTextEffectInserts a WordArt object.
addWordArtAdds preset WordArt since Excel 2007.s
addRectangleAdds a RectangleShape to the worksheet.
addOvalAdds a Oval to the worksheet.
addLineAdds a LineShape to the worksheet.
addFreeFloatingShapeAdds a free floating shape to the worksheet.Only applies for line/image shape.
addShapeInChartAdd a shape to chart .All unit is 1/4000 of chart area.
addShapeInChartByScaleAdd a shape to chart. All unit is percent scale of chart area.
addArcAdds a ArcShape to the worksheet.
addShapeAdds a Shape to the worksheet.

The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox | | addAutoShape | Adds a AutoShape to the worksheet.

The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox | | addAutoShapeInChart | Adds a AutoShape to the chart.

The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox | | addActiveXControl | Creates an Activex Control. | | addSvg | Adds svg image. | | addIcons | Adds svg image. | | addLinkedPicture | Add a linked picture. | | addOleObjectWithLinkedImage | Add a linked picture. | | addOleObject | Adds an OleObject. | | copyCommentsInRange | Copy all comments in the range. | | copyInRange | Copy shapes in the range to destination range. | | deleteInRange | Delete shapes in the range.Comment shapes will not be deleted. | | deleteShape | Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted. | | group | Group the shapes.

The shape in the groupItems should not be grouped. The shape must be in this Shapes collection. | | ungroup | Ungroups the shape items.

If the group shape is grouped by another group shape,nothing will be done. | | removeAt | Remove the shape. | | remove | Remove the shape. | | clear | Clear all shapes in the worksheet. | | updateSelectedValue | Update the selected value by the value of the linked cell or range of the shape. | | addFreeform | | | addSignatureLine | | | iterator | | | get | Reserved for internal use. | | contains | Reserved for internal use. | | indexOf | Reserved for internal use. | | addPictureFromBytes | Adds a picture to the collection. | | addPictureInChartFromBytes | Adds a picture to the chart. |

ShapeCollection.Count property

Type: int

ShapeCollection.Item (int) property

Gets the Shape object at the specific index in the list.

Type: Shape

ShapeCollection.Item (java.lang.String) property

Gets the Shape object by the name of the shape.

Type: Shape

addCopy(sourceShape, topRow, top, leftColumn, left) (1 of 2)

Adds and copy a shape to the worksheet.

ParameterTypeDescription
sourceShapeShapeSource shape.
topRowintThe top row index.
topintRepresents the vertical offset from its top row, in unit of pixel.
leftColumnintThe left column index.
leftintRepresents the horizontal offset from its left column, in unit of pixel.

Returns: The new Shape object.


addCopy(sourceShape, topRow, top, leftColumn, left, copyOptions) (2 of 2)

addCheckBox(topRow, top, leftColumn, left, height, width)

Adds a checkbox to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of checkbox from its top row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of textbox from its left column, in unit of pixel.
heightintHeight of textbox, in unit of pixel.
widthintWidth of textbox, in unit of pixel.

Returns: The new CheckBox object index.

addTextBox(topRow, top, leftColumn, left, height, width)

Adds a text box to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of textbox from its top row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of textbox from its left column, in unit of pixel.
heightintRepresents the height of textbox, in unit of pixel.
widthintRepresents the width of textbox, in unit of pixel.

Returns: A TextBox object.

addEquation(topRow, top, leftColumn, left, height, width)

Add an equation object to the worksheet.

ParameterTypeDescription
topRowintThe top row index.
topintThe vertical offset its top row, in unit of pixel.
leftColumnintThe left column index.
leftintThe horizontal offset from its left column, in unit of pixel.
heightintThe height of equation, in unit of pixel.
widthintThe width of equation, in unit of pixel.

addLaTeXEquation(topRow, top, leftColumn, left, height, width, latex)

addSpinner(topRow, top, leftColumn, left, height, width)

Adds a Spinner to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of Spinner from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of Spinner from its left column, in unit of pixel.
heightintRepresents the height of Spinner, in unit of pixel.
widthintRepresents the width of Spinner, in unit of pixel.

Returns: A Spinner object.

addScrollBar(topRow, top, leftColumn, left, height, width)

Adds a ScrollBar to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of ScrollBar from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of ScrollBar from its left column, in unit of pixel.
heightintRepresents the height of ScrollBar, in unit of pixel.
widthintRepresents the width of ScrollBar, in unit of pixel.

Returns: A ScrollBar object.

addRadioButton(topRow, top, leftColumn, left, height, width)

Adds a RadioButton to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of RadioButton from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of RadioButton from its left column, in unit of pixel.
heightintRepresents the height of RadioButton, in unit of pixel.
widthintRepresents the width of RadioButton, in unit of pixel.

Returns: A RadioButton object.

addListBox(topRow, top, leftColumn, left, height, width)

Adds a ListBox to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of ListBox from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of ListBox from its left column, in unit of pixel.
heightintRepresents the height of ListBox, in unit of pixel.
widthintRepresents the width of ListBox, in unit of pixel.

Returns: A ListBox object.

addComboBox(topRow, top, leftColumn, left, height, width)

Adds a ComboBox to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of ComboBox from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of ComboBox from its left column, in unit of pixel.
heightintRepresents the height of ComboBox, in unit of pixel.
widthintRepresents the width of ComboBox, in unit of pixel.

Returns: A ComboBox object.

addGroupBox(topRow, top, leftColumn, left, height, width)

Adds a GroupBox to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of GroupBox from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of GroupBox from its left column, in unit of pixel.
heightintRepresents the height of GroupBox, in unit of pixel.
widthintRepresents the width of GroupBox, in unit of pixel.

Returns: A GroupBox object.

addButton(topRow, top, leftColumn, left, height, width)

Adds a Button to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of Button from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of Button from its left column, in unit of pixel.
heightintRepresents the height of Button, in unit of pixel.
widthintRepresents the width of Button, in unit of pixel.

Returns: A Button object.

addLabel(topRow, top, leftColumn, left, height, width)

Adds a Label to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of Label from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of Label from its left column, in unit of pixel.
heightintRepresents the height of Label, in unit of pixel.
widthintRepresents the width of Label, in unit of pixel.

Returns: A Label object.

addLabelInChart(top, left, height, width)

Adds a label to the chart.

ParameterTypeDescription
topintRepresents the vertical offset of label from the upper left corner in units of 1/4000 of the chart area.
leftintRepresents the vertical offset of label from the upper left corner in units of 1/4000 of the chart area.
heightintRepresents the height of label, in units of 1/4000 of the chart area.
widthintRepresents the width of label, in units of 1/4000 of the chart area.

Returns: A new Label object.

addTextBoxInChart(top, left, height, width)

Adds a textbox to the chart.

ParameterTypeDescription
topintRepresents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
leftintRepresents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
heightintRepresents the height of textbox, in units of 1/4000 of the chart area.
widthintRepresents the width of textbox, in units of 1/4000 of the chart area.

Returns: A TextBox object.

addTextEffectInChart(effect, text, fontName, size, fontBold, fontItalic, top, left, height, width)

Inserts a WordArt object to the chart

ParameterTypeDescription
effectintA MsoPresetTextEffect value. The mso preset text effect type.
textStringThe WordArt text.
fontNameStringThe font name.
sizeintThe font size
fontBoldbooleanIndicates whether font is bold.
fontItalicbooleanIndicates whether font is italic.
topintRepresents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
leftintRepresents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
heightintRepresents the height of shape, in units of 1/4000 of the chart area.
widthintRepresents 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(effect, text, fontName, size, fontBold, fontItalic, topRow, top, leftColumn, left, height, width)

Inserts a WordArt object.

ParameterTypeDescription
effectintA MsoPresetTextEffect value. The mso preset text effect type.
textStringThe WordArt text.
fontNameStringThe font name.
sizeintThe font size
fontBoldbooleanIndicates whether font is bold.
fontItalicbooleanIndicates whether font is italic.
upperLeftRowUpper left row index.
topintRepresents the vertical offset of shape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of shape from its left column, in unit of pixel.
heightintRepresents the height of shape, in unit of pixel.
widthintRepresents the width of shape, in unit of pixel.

Returns: Returns a Shape object that represents the new WordArt object.

addWordArt(style, text, topRow, top, leftColumn, left, height, width)

Adds preset WordArt since Excel 2007.s

ParameterTypeDescription
styleintA PresetWordArtStyle value. The preset WordArt Style.
textStringThe text.
upperLeftRowUpper left row index.
topintRepresents the vertical offset of shape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of shape from its left column, in unit of pixel.
heightintRepresents the height of shape, in unit of pixel.
widthintRepresents the width of shape, in unit of pixel.

addRectangle(topRow, top, leftColumn, left, height, width)

Adds a RectangleShape to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of RectangleShape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of RectangleShape from its left column, in unit of pixel.
heightintRepresents the height of RectangleShape, in unit of pixel.
widthintRepresents the width of RectangleShape, in unit of pixel.

Returns: A RectangleShape object.

addOval(topRow, top, leftColumn, left, height, width)

Adds a Oval to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of Oval from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of Oval from its left column, in unit of pixel.
heightintRepresents the height of Oval, in unit of pixel.
widthintRepresents the width of Oval, in unit of pixel.

Returns: A Oval object.

addLine(topRow, top, leftColumn, left, height, width)

Adds a LineShape to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of LineShape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of LineShape from its left column, in unit of pixel.
heightintRepresents the height of LineShape, in unit of pixel.
widthintRepresents the width of LineShape, in unit of pixel.

Returns: A LineShape object.

addFreeFloatingShape(type, top, left, height, width, imageData, isOriginalSize)

Adds a free floating shape to the worksheet.Only applies for line/image shape.

ParameterTypeDescription
typeintA MsoDrawingType value. The shape type.
topintRepresents the vertical offset of shape from the worksheet’s top row, in unit of pixel.
leftintRepresents the horizontal offset of shape from the worksheet’s left column, in unit of pixel.
heightintRepresents the height of LineShape, in unit of pixel.
widthintRepresents the width of LineShape, in unit of pixel.
imageDatabyte[]The image data,only applies for the picture.
isOriginalSizebooleanWhether the shape use original size if the shape is image.

addShapeInChart(type, placement, left, top, right, bottom, imageData) (1 of 2)

Add a shape to chart .All unit is 1/4000 of chart area.

ParameterTypeDescription
typeintA MsoDrawingType value. The drawing type.
placementintA PlacementType value. the placement type.
leftintIn unit of 1/4000 chart area width.
topintIn unit of 1/4000 chart area height.
rightintIn unit of 1/4000 chart area width.
bottomintIn unit of 1/4000 chart area height.
imageDatabyte[]If the shape is not a picture or ole object,imageData should be null.

addShapeInChart(type, placement, left, top, right, bottom) (2 of 2)

Add a shape to chart .All unit is 1/4000 of chart area.

ParameterTypeDescription
typeintA MsoDrawingType value. The drawing type.
placementintA PlacementType value. the placement type.
leftintIn unit of 1/4000 chart area width.
topintIn unit of 1/4000 chart area height.
rightintIn unit of 1/4000 chart area width.
bottomintIn unit of 1/4000 chart area height.

addShapeInChartByScale(type, placement, left, top, right, bottom) (1 of 2)

Add a shape to chart. All unit is percent scale of chart area.

ParameterTypeDescription
typeintA MsoDrawingType value. The drawing type.
placementintA PlacementType value. the placement type.
leftfloatUnit is percent scale of chart area width.
topfloatUnit is percent scale of chart area height.
rightfloatUnit is percent scale of chart area width.
bottomfloatUnit is percent scale of chart area height.

addShapeInChartByScale(type, placement, left, top, right, bottom, imageData) (2 of 2)

Add a shape to chart .All unit is 1/4000 of chart area.

ParameterTypeDescription
typeintA MsoDrawingType value. The drawing type.
placementintA PlacementType value. the placement type.
leftfloatUnit is percent scale of chart area width.
topfloatUnit is percent scale of chart area height.
rightfloatUnit is percent scale of chart area width.
bottomfloatUnit is percent scale of chart area height.
imageDatabyte[]If the shape is not a picture or ole object,imageData should be null.

addArc(topRow, top, leftColumn, left, height, width)

Adds a ArcShape to the worksheet.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of ArcShape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of ArcShape from its left column, in unit of pixel.
heightintRepresents the height of ArcShape, in unit of pixel.
widthintRepresents the width of ArcShape, in unit of pixel.

Returns: A ArcShape object.

addShape(type, topRow, top, leftColumn, left, height, width)

Adds a Shape to the worksheet.

The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox

ParameterTypeDescription
typeintA MsoDrawingType value. Mso drawing type.
upperLeftRowUpper left row index.
topintRepresents the vertical offset of Shape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of Shape from its left column, in unit of pixel.
heightintRepresents the height of Shape, in unit of pixel.
widthintRepresents the width of Shape, in unit of pixel.

Returns: A Shape object.

addAutoShape(type, topRow, top, leftColumn, left, height, width)

Adds a AutoShape to the worksheet.

The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox

ParameterTypeDescription
typeintA AutoShapeType value. Auto shape type.
upperLeftRowUpper left row index.
topintRepresents the vertical offset of Shape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintRepresents the horizontal offset of Shape from its left column, in unit of pixel.
heightintRepresents the height of Shape, in unit of pixel.
widthintRepresents the width of Shape, in unit of pixel.

Returns: A Shape object.

addAutoShapeInChart(type, top, left, height, width)

Adds a AutoShape to the chart.

The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox

ParameterTypeDescription
typeintA AutoShapeType value. Auto shape type.
topintRepresents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
leftintRepresents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.
heightintRepresents the height of textbox, in units of 1/4000 of the chart area.
widthintRepresents the width of textbox, in units of 1/4000 of the chart area.

Returns: Returns a shape object.

addActiveXControl(type, topRow, top, leftColumn, left, width, height)

Creates an Activex Control.

ParameterTypeDescription
typeintA ControlType value. The type of the control.
topRowintUpper left row index.
topintRepresents the vertical offset of Shape from its left row, in unit of pixel.
leftColumnintUpper left column index.
leftintRepresents the horizontal offset of Shape from its left column, in unit of pixel.
heightintRepresents the height of Shape, in unit of pixel.
widthintRepresents the width of Shape, in unit of pixel.

addSvg(topRow, top, leftColumn, left, height, width, svgData, compatibleImageData)

Adds svg image.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of shape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintThe horizontal offset of shape from its left column, in unit of pixel.
heightintThe height of shape, in unit of pixel.
widthintThe width of shape, in unit of pixel.
svgDatabyte[]The svg image data.
compatibleImageDatabyte[]Converted image data from svg in order to be compatible with Excel 2016 or lower versions.

addIcons(topRow, top, leftColumn, left, height, width, imageByteData, compatibleImageData)

Adds svg image.

ParameterTypeDescription
upperLeftRowUpper left row index.
topintRepresents the vertical offset of shape from its left row, in unit of pixel.
upperLeftColumnUpper left column index.
leftintThe horizontal offset of shape from its left column, in unit of pixel.
heightintThe height of shape, in unit of pixel.
widthintThe width of shape, in unit of pixel.
imageByteDatabyte[]The image byte data.
compatibleImageDatabyte[]Converted image data from svg in order to be compatible with Excel 2016 or lower versions.

addLinkedPicture(topRow, leftColumn, height, width, sourceFullName)

Add a linked picture.

ParameterTypeDescription
upperLeftRowUpper left row index.
upperLeftColumnUpper left column index.
heightintThe height of the shape. In unit of pixels
widthintThe width of the shape. In unit of pixels
sourceFullNameStringThe path and name of the source file for the linked image

Returns: Picture Picture object.

addOleObjectWithLinkedImage(topRow, leftColumn, height, width, sourceFullName)

Add a linked picture.

ParameterTypeDescription
upperLeftRowUpper left row index.
upperLeftColumnUpper left column index.
heightintThe height of the shape. In unit of pixels
widthintThe width of the shape. In unit of pixels
sourceFullNameStringThe path and name of the source file for the linked image

Returns: Picture Picture object.

addOleObject(topRow, top, leftColumn, left, height, width, imageData)

Adds an OleObject.

ParameterTypeDescription
upperLeftRow
topint
upperLeftColumn
leftint
heightint
widthint
imageDatabyte[]

copyCommentsInRange(shapes, ca, destRow, destColumn)

Copy all comments in the range.

ParameterTypeDescription
shapesShapeCollectionThe source shapes.
caCellAreaThe source range.
destRowintThe dest range start row.
destColumnintThe dest range start column.

copyInRange(sourceShapes, ca, destRow, destColumn, isContained)

Copy shapes in the range to destination range.

ParameterTypeDescription
sourceShapesShapeCollectionSource shapes.
caCellAreaThe source range.
destRowintThe dest row index of the dest range.
destColumnintThe dest column of the dest range.
isContainedbooleanWhether 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(ca)

Delete shapes in the range.Comment shapes will not be deleted.

ParameterTypeDescription
caCellAreaThe range.If the shapes are contained in the range, they will be removed.

deleteShape(shape)

Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted.

ParameterTypeDescription
shapeShape

group(groupItems)

Group the shapes.

The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.

ParameterTypeDescription
groupItemsShape[]the group items.

Returns: Return the group shape.

ungroup(group)

Ungroups the shape items.

If the group shape is grouped by another group shape,nothing will be done.

ParameterTypeDescription
groupGroupShapeThe group shape.

removeAt(index)

Remove the shape.

ParameterTypeDescription
indexintThe index of the shape.

remove(shape)

Remove the shape.

ParameterTypeDescription
shapeShape

clear()

Clear all shapes in the worksheet.

updateSelectedValue()

Update the selected value by the value of the linked cell or range of the shape.

addFreeform(topRow, top, leftColumn, left, height, width, paths)

addSignatureLine(topRow, leftColumn, signatureLine)

iterator()

get(index)

Reserved for internal use.

contains(value)

Reserved for internal use.

indexOf(value)

Reserved for internal use.

addPictureFromBytes(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, byte_array) (1 of 2)

Adds a picture to the collection.

ParameterTypeDescription
upperLeftRowintUpper left row index
upperLeftColumnintUpper left column index
lowerRightRowintLower right row index
lowerRightColumnintLower right column index
byte_arraybytesThe byte array

Returns: Returns a Picture objct

Example:

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *

wb = Workbook(FileFormatType.XLSX)
with open('cells.png', 'rb') as pic:
    pic_bytes = pic.read()
    wb.getWorksheets().get(0).getShapes().addPictureFromBytes(2, 7, lowerRightRow=10, lowerRightColumn=10, byte_array=pic_bytes)
wb.save("wb.xlsx")

jpype.shutdownJVM()

addPictureFromBytes(upperLeftRow, upperLeftColumn, byte_array, widthScale, heightScale) (2 of 2)

Adds a picture to the collection.

ParameterTypeDescription
upperLeftRowintUpper left row index
upperLeftColumnintUpper left column index
byte_arraybytesThe byte array
widthScaleintScale of image width, a percentage
heightScaleintScale of image height, a percentage

Returns: Returns a Picture objct

Example:

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *

wb = Workbook(FileFormatType.XLSX)
with open('cells.png', 'rb') as pic:
    pic_bytes = pic.read()
    wb.getWorksheets().get(0).getShapes().addPictureFromBytes(2, 0, byte_array=pic_bytes, widthScale=200, heightScale=150)
wb.save("wb.xlsx")

jpype.shutdownJVM()

addPictureInChartFromBytes(top, left, byte_array, widthScale, heightScale)

Adds a picture to the chart.

ParameterTypeDescription
topintRepresents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area
leftintRepresents the horizontal offset of shape from the upper left corner in units of 1/4000 of the chart area
byte_arraybytesThe byte array
widthScaleintScale of image width, a percentage
heightScaleintScale of image height, a percentage

Returns: Returns a Picture objct

Example:

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *

wb = Workbook('Book2.xlsx')
shapes = wb.getWorksheets().get("Chart").getCharts().get(0).getShapes()
with open('cells.png', 'rb') as pic:
    picture = shapes.addPictureInChartFromBytes(1, 1, pic.read(), 10, 5)
wb.save("wb.xlsx")

jpype.shutdownJVM()