add_freeform method

add_freeform

Adds a freeform shape to the worksheet.

Returns

A freeform shape.

def add_freeform(self, upper_left_row, top, upper_left_column, left, height, width, paths):
    ...
ParameterTypeDescription
upper_left_rowintUpper left row index.
topintRepresents the vertical offset of Polygon from its left row, in unit of pixel.
upper_left_columnintUpper left column index.
leftintRepresents the horizontal offset of Polygon from its left column, in unit of pixel.
heightintRepresents the height of Polygon, in unit of pixel.
widthintRepresents the width of Polygon, in unit of pixel.
pathslistRepresents a user-defined path

Example

from aspose.cells.drawing import ShapePath

# Custom figure
shapePath = ShapePath()
shapePath.move_to(60, 45)
shapePath.arc_to(25, 25, 0, 270)
shapePath.close()
shapePath.move_to(60, 20)
shapePath.line_to(110, 70)
shapePath.line_to(125, 155.5)
shapePath.arc_to(35.5, 35.5, 0, 270)
shapePath.close()
shapePath.move_to(150, 45)
shapePath.arc_to(25, 25, 0, 270)
shapePath1 = ShapePath()
shapePath1.move_to(0, 0)
shapePath1.cubic_bezier_to(48.24997, 0.6844,                                 96.5, -7.148871,                                 130, 11.517795)
shapePath1.cubic_bezier_to(163.5, 30.18446,                                 182.24997, 75.351,                                 201, 120.517795)
shapePath1.move_to(150, 80)
shapePath1.arc_to(25, 25, 0, 270)
# Insert custom figure into worksheet
shapes.add_freeform(1, 0, 1, 0, 200, 200, [shapePath, shapePath1])

See Also