Image Width Issue

Hi Aspose Team,


I want to insert image in excel
and i used the following
string imgPath = HttpContext.Current.Server.MapPath(@"~/Images/survey_metrics_logoExcel.png");
int pictureIndex = excelWorkSheet.Pictures.Add(0, 0,imgPath, 80, 95);
Aspose.Cells.Drawing.Picture picture = excelWorkSheet.Pictures[pictureIndex];

Picture is inserted in my excel sheet, and
I have Pivot table down to the above image in Excel, the issue is:
Image width is increasing based on column width of pivot table, which i dont need.
I need to have static width and height of image, irrespective of column width.

i have attached Two Excel files, where it shows the difference in width of two images based on column width.

Can u get back to me on this.

Hi Venkatesh,


Thanks for providing us some details.

I could not find your attachments, probably you forgot to attach them here.
I think you may try to use Placement attribute to set to “FreeFloating” if it makes any difference.

E.g

Sample code:

//…
int index = worksheet.Pictures.Add(0,0, imgPath, 80, 95);
Picture pic = worksheet.Pictures[index];
pic.Placement = PlacementType.FreeFloating;


If you still find the issue, kindly do provide us your input and output files, also attach your picture file here, we will check your issue soon.

Thank you.