Hi,Support:
Is there any method to extract each or given size of image in a worksheet?
And how to determine whether a shape is a image object.
For Words.dll, this can be implemented by Shape.Imagedata.save(path).
Thanks for your help.
Hi,Support:
Is there any method to extract each or given size of image in a worksheet?
And how to determine whether a shape is a image object.
For Words.dll, this can be implemented by Shape.Imagedata.save(path).
Thanks for your help.
See the following sample code for your reference:
e.g.
Sample code:
var workbook = new Workbook("e:\\test2\\Bk_sampleshapes.xlsx");
var worksheet = workbook.Worksheets[0];
var shapes = worksheet.Shapes;
foreach (Shape shape in shapes)
{
Type type = shape.GetType;
switch (type.FullName)
{
case "Aspose.Cells.Drawing.ComboBox":
Aspose.Cells.Drawing.ComboBox comboBox = (Aspose.Cells.Drawing.ComboBox)shape;
Console.WriteLine("This is a ComboBox " + comboBox.Name + " :" + comboBox.SelectedValue);
continue;
case "Aspose.Cells.Drawing.TextBox":
Aspose.Cells.Drawing.TextBox textBox = (Aspose.Cells.Drawing.TextBox)shape;
Console.WriteLine("This is a TextBox " + textBox.Name + " :" + textBox.Text);
continue;
case "Aspose.Cells.Drawing.CheckBox":
Aspose.Cells.Drawing.CheckBox checkBox = (Aspose.Cells.Drawing.CheckBox)shape;
Console.WriteLine("This is a CheckBox " + checkBox.Name + " :" + checkBox.CheckedValue);
continue;
case "Aspose.Cells.Drawing.Picture":
Aspose.Cells.Drawing.Picture pic = (Aspose.Cells.Drawing.Picture)shape;
byte[] data = pic.Data;
Bitmap bmp = new Bitmap(new MemoryStream(data));
bmp.Save("e:\\test2\\out1.jpg", ImageFormat.Jpeg);
continue;
}
}
Hope, this helps a bit.