Free Support Forum - aspose.com

How to get Shape information

Dear,
In RectangleShape, I can not get or set the string value of this shape.
Pls show me how to do it?
Thanks,
Khaitd.

Hi,

Thanks for considering Aspose.

You mean to say you want to get the designer Rectangle shape object and you want to get its attributes, you may utilize the following sample code:

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\bkshapes.xls");
Worksheet sheet = workbook.Worksheets[0];
//Get the first shape in the worksheet.
Aspose.Cells.Shape shape = sheet.Shapes[0];
//If the first shape is rectangle shape.
if(shape.GetType().ToString()=="Aspose.Cells.RectangleShape")
{
Aspose.Cells.RectangleShape rec = (Aspose.Cells.RectangleShape)shape;

string place = rec.Placement.ToString();
double lnwt = rec.LineFormat.Weight;
int ht = rec.Height;
int width = rec.Width;
.................

}
Thank you.
Thank you.

Thanks for your reply but that is not what I mean.

Ex: I add a RectangleShape into excel file and add text in this RectangleShape. In aspose, how can I get or set this text?

Thank you,
Khaitd.

Hi,

I think for your need, you may add TextBox control which allows you to set/get text string,

Please check:

http://www.aspose.com/Wiki/default.aspx/Aspose.Cells/OtherDrawingObjects.html#TextBox

Thank you.

Dear,
Now, I just use the RectangleShape. So I can replace it to Textbox.
But If I use another Shape (ex: Circle, or some of shapes), How can I get or set that?
Best regard,
Khaitd.

Hi,

I think you may place a label or textbox control inside a cricle or other shapes.

Thank you.

Dear,
That a good idea. Thank you very much.
But I want to get the Bitmap of this Shape, do you support that?

Thanks,
Khaitd.

Hi,

No the feature is not supported.

Thank you.

Thank you very much.
I think that’s enough to me.

Regard,
Khaitd.