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

Free Support Forum - aspose.com

Find an autoshape on excel sheet

I need to find an existing shape on excel sheet. When I needed to do it on a slide I just put a name of a shape in Web/AlternativeText property of an existing box but aspose.cells.shape does not have this property accessible. How we do it in Excel?


If you are talking about a textbox control and want to extract the text in the textbox, you may use Aspose.Cells.TextBox.Text property.

Here is the sample code:

Sample code:

Workbook wb = new Workbook();

Aspose.Cells.RadioButton radio = null;
Aspose.Cells.TextBox textbox = null;

foreach (Aspose.Cells.Shape shape in wb.Worksheets["Sheet1"].Shapes)

if (shape.GetType().ToString() == "Aspose.Cells.RadioButton")
radio = (Aspose.Cells.RadioButton)shape;
string rdtext = radio.Text;
string wchecked = radio.IsChecked.ToString();

if (shape.GetType().ToString() == "Aspose.Cells.TextBox")
textbox = (Aspose.Cells.TextBox)shape;
string text = textbox.Text;



Thank you.

Amjad, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your reaction.

I am talking about the cube on the image. I have rows in a template which have this cubes in first column. I need to delete some rows but the cubes do not get deleted automatically. So I need to delete them separately.


Well, I 'm afraid we don't support to create / delete the cube autoshapes, we will check if we may consider to support it in our future versions.

Thank you.

OK, what shape would you suggest to put into template to be able to delete them?



1,You can use Shape.Name to find a shape.

2, If you delete some rows, we do not delete the shapes rather make them with 0 heights only.they are there but not visible anymore. It works as MS Excel.

3,You can delete all shapes in the tempalte file. If the shape is refered by VBA codes, we do not support to delete it because we do not operate VBA codes now.

4, We support to create Line,Rectangle,Oval,Arc autoshape.

1. How do I know the Shape.Name? There are in my template, not placed by program.

2. The are visible as a line after I delete a row.

3. I cannot delete all shapes. I have many they need to stay there.

4. I will probably replace them, if you do not have a solution. This cube was a clien request.

Thanks anyway.


Hi vlado,

1,If you do not set the name of the shape, you will get an auto name. Example : if the shape is Rectangle and the index of the shape is zero, the shape name is Rectangle 1.

2,It works as MS Excel.

3,You can use Shapes.DeleteShape() to delete a shape.

4,We will try to support to add Cube shape. We could not support all autoShape types. Could you list which types you want to add?

Hi vlado,

Please try this fix.

We have supported to add Cube shape. Please use Shapes.AddAutoShape(AutoShapeType type, int upperLeftRow, int top,
int upperLeftColumn, int left, int height, int width) to add an autoshape.