Floating Objects

Floating objects are Drawing Shapes, Images and Charts. All floating objects displayed on worksheet inherited from FloatingObject class.

Inheritance Hierarchy

Create Floating Object

The following code creates a rectangle object:

var rectObj = new Drawing.Shapes.RectangleShape()
{
  // set the location of rectangle
  Location = new Graphics.Point(50, 50),

  // set the size of rectangle
  Size = new Graphics.Size(200, 100),
};

Add Floating Object

To add a floating object onto worksheet, put the object into the collection FloatingObjects of worksheet:

// get current selected worksheet
var worksheet = control.CurrentWorksheet;

// adding rectangle on worksheet
worksheet.FloatingObjects.Add(rectObj);

Result:

262

Floating Image

261

To add an images on worksheet, see Floating Image.

See Also


Next: Floating Image