Hi,
I am using evalution copy of Aspose.cells.
I am adding some images while creating a workbook using Aspose code. After adding images, i am changing column width and row height. When i changed the width and height image get streched.
Is there any property which restrict images to strech while changing the width and height of column & row?
Thanks & Regards,
Sanjeev Gharmode
Hi,
Thank you for considering Aspose.
You can use Picture.Placement = PlacementType.FreeFloating option to restrict the image not to stretch. Please see the following sample code in this regard.
Sample Code:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Workbook object
int sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Adding a picture at the location of a cell
int pic = worksheet.Pictures.Add(5, 5, "C:\\excels\\CB1.jpg");
Picture picture = worksheet.Pictures[pic];
picture.Placement = PlacementType.FreeFloating;
//Saving the Excel file
workbook.Save("c:\\book1.xls", FileFormatType.Default);
Thank You & Best Regards,