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

Free Support Forum - aspose.com

Remove button from cell

Hi Team,

Please advise how to remove custom created button with name “Button1” from the cell.
This cell may include some text. But I need to remove only button.

Thank you,
pa

@rudolfkalik

Thanks for considering Aspose APIs.

Please use the following methods and properties for your needs.

Worksheet.Shapes
Worksheet.Shapes.RemoveAt()
Shape.Name

Please see the sample input and output Excel files used in the following code as well as screenshot for your help.

Download Link:
Sample Input and Output Excel Files.zip (17.8 KB)

C#

Workbook wb = new Workbook("sample.xlsx");

Worksheet ws = wb.Worksheets[0];

for(int i=0; i<ws.Shapes.Count; i++)
{
    Shape sh = ws.Shapes[i];

    Debug.WriteLine(i + "---" + sh.Name);
}

//Remove Button 1
ws.Shapes.RemoveAt(0);

wb.Save("output.xlsx");

Screenshot:

Thank you. I will try.
pa