PictureCollection

PictureCollection class

Encapsulates a collection of Picture objects.

Properties

NameTypeDescription
Countint
Item (int)PictureGets the Picture element at the specified index.

Methods

NameDescription
camera
addAdds a picture to the collection.
clearClear all pictures.
removeAtRemove shapes at the specific index
iterator
getReserved for internal use.
containsReserved for internal use.
indexOfReserved for internal use.
addPictureFromBytesAdds a picture to the collection.

PictureCollection.Count property

Type: int

PictureCollection.Item (int) property

Gets the Picture element at the specified index.

Type: Picture

camera(row, column, range)

add(topRow, leftColumn, bottomRow, rightColumn, fileName) (1 of 3)

Adds a picture to the collection.

ParameterTypeDescription
upperLeftRowUpper left row index.
upperLeftColumnUpper left column index.
lowerRightRowLower right row index
lowerRightColumnLower right column index
fileNameStringImage filename.

Returns: Picture object index.


add(topRow, leftColumn, fileName) (2 of 3)

Adds a picture to the collection.

ParameterTypeDescription
upperLeftRowUpper left row index.
upperLeftColumnUpper left column index.
fileNameStringImage filename.

Returns: Picture object index.


add(topRow, leftColumn, fileName, widthScale, heightScale) (3 of 3)

Adds a picture to the collection.

ParameterTypeDescription
upperLeftRowUpper left row index.
upperLeftColumnUpper left column index.
fileNameStringImage filename.
widthScaleintScale of image width, a percentage.
heightScaleintScale of image height, a percentage.

Returns: Picture object index.

clear()

Clear all pictures.

removeAt(index)

Remove shapes at the specific index

iterator()

get(index)

Reserved for internal use.

contains(value)

Reserved for internal use.

indexOf(value)

Reserved for internal use.

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

Adds a picture to the collection.

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

Returns: Picture object index.

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).getPictures().addPictureFromBytes(2, 7, byte_array=pic_bytes, lowerRightRow=10, lowerRightColumn=10)
wb.save("wb.xlsx")

jpype.shutdownJVM()

addPictureFromBytes(upperLeftRow, upperLeftColumn, byte_array) (2 of 3)

Adds a picture to the collection.

ParameterTypeDescription
upperLeftRowintUpper left row index
upperLeftColumnintUpper left column index
byte_arraybytesThe byte array

Returns: Picture object index.

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).getPictures().addPictureFromBytes(2, 2, byte_array=pic_bytes)
wb.save("wb.xlsx")

jpype.shutdownJVM()

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

Adds a picture to the collection.

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

Returns: Picture object index.

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).getPictures().addPictureFromBytes(0, 0, widthScale=200, heightScale=150, byte_array=pic_bytes)
wb.save("wb.xlsx")

jpype.shutdownJVM()