We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Deleting shape from a group


I have a requirement to delete a shape from a group of shapes

for example

foreach (var item in group.GetGroupedShapes())
if (string.CompareOrdinal(item.Name, shapeToBeDeleted) == 0)
//will this work for shapes which are a part of a group and also which are not?

// the method summary for DeleteShape says that shapes in groups will not be deleted


Could you please let me know how to go about this?


Hi Yashali,

Thank you for contacting Aspose support.

We would recommend you to use the Shapes.RemoveAt method that allows to delete a shape regardless of the fact that the given shape is grouped. Please check the following piece of code for better elaboration and attached spreadsheets for your reference.


var _workbook = new Workbook(“D:/temp/input.xls”);
var _worksheet = _workbook.Worksheets[“Sheet1”];
var _shapes = _worksheet.Shapes;
for(int _index = 0; _index <= _shapes.Count; _index++)
if(_shapes[_index].Name == “Oval 2”)