ShapeCollection.AddFreeFloatingShape

ShapeCollection.AddFreeFloatingShape method

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

public Shape AddFreeFloatingShape(MsoDrawingType type, int top, int left, int height, int width, 
    byte[] imageData, bool isOriginalSize)
ParameterTypeDescription
typeMsoDrawingTypeThe shape type.
topInt32Represents the vertical offset of shape from the worksheet’s top row, in unit of pixel.
leftInt32Represents the horizontal offset of shape from the worksheet’s left column, in unit of pixel.
heightInt32Represents the height of LineShape, in unit of pixel.
widthInt32Represents 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.

Examples


[C#]
//add a line
Shape floatingShape_Line = shapes.AddFreeFloatingShape(MsoDrawingType.Line, 100, 100, 100, 50, null, false);
//add a picture
byte[] imageData = null;
using(FileStream fs = new FileStream("image.jpg", FileMode.Open))
{
    int len = (int)fs.Length;
    imageData = new byte[len];
    fs.Read(imageData, 0, len);
}
Shape floatingShape_Picture = shapes.AddFreeFloatingShape(MsoDrawingType.Picture, 200, 100, 100, 50, imageData, false);

See Also