add_free_floating_shape method

add_free_floating_shape

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

Returns

def add_free_floating_shape(self, type, top, left, height, width, image_data, is_original_size):
    ...
ParameterTypeDescription
typeMsoDrawingTypeThe 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.
image_databytesThe image data,only applies for the picture.
is_original_sizeboolWhether the shape use original size if the shape is image.

Example

from aspose import pycore
from aspose.cells.drawing import MsoDrawingType
import bytearray
import int

# add a line
floatingShape_Line = shapes.add_free_floating_shape(MsoDrawingType.LINE, 100, 100, 100, 50, None, False)
# add a picture
imageData = None
with open("image.jpg", "rb") as fs:
    len = pycore.cast(int, utils.filesize(fs))
    imageData = bytearray(len)
    fs.readinto(imageData)
floatingShape_Picture = shapes.add_free_floating_shape(MsoDrawingType.PICTURE, 200, 100, 100, 50, imageData, False)

See Also