Free Support Forum - aspose.com

How to set height and width for pictures in aspose.cells 2003 V4.1.1.0

Hi,

I'm trying to work with aspose 2003 and generationg images on excel templates.

I have generated ,scaled and centered the image using aspose 2007 version 4.4.0, but for some reason I'm bound to use only 2003 version. So I see lot of properties are not there in 2003. I'm pasting my code for 2007 version here.

int temp = sheet.Pictures.Add(1, 1, str);

Picture pic = sheet.Pictures[temp];

int picWidth = pic.OriginalWidth;

//Scaling the image

if (pic.OriginalWidth > c || pic.OriginalHeight > d)

{

if (pic.OriginalWidth > c)

{

double percentageWidth = (c * 100) / (float)pic.Width;

pic.Width = c;

pic.Height = Convert.ToInt32(percentageWidth * pic.Height / 100);

}

if (pic.Height > d)

{

double percentageHeight = (d * 100) / (float)pic.Height;

pic.Height = d;

pic.Width = Convert.ToInt32(percentageHeight * pic.Width / 100);

}

}

else

{

pic.Height = d;

double percentageHeight = (d * 100) / (float)pic.OriginalHeight;

pic.Width = Convert.ToInt32(percentageHeight * pic.OriginalWidth / 100);

if (pic.Width > c)

{

double percentageWidth = (c * 100) / (float)pic.Width;

pic.Width = c;

pic.Height = Convert.ToInt32(percentageWidth * pic.Height / 100);

}

}

please tell me what are the equalent properties to get/set height, width of a picture in aspose 2003 version

thanks.

Hi,

What do you mean by aspose 2003, which version of Aspose.Cells / Excel you are using?

Thank you.