Free Support Forum -

How to insert a picture by using position instead row and column

Hi, since we have a logo placed in the top right corner and Excel sheet columns width variates from export to export, sometimes the logo gets out of print area. Is there a way to place a free floating image by using position (cm/pixel) instead of using upper left row and upper left column?

thanks & regards


Workbook wb = new Workbook();


Worksheet ws = wb.Worksheets.Add("New");

using (MemoryStream stream = new MemoryStream())


AsposeTest.Properties.Resources.Logo.Save(stream, ImageFormat.Jpeg);

int logopicture = ws.Pictures.Add(1, 10, stream);

Aspose.Cells.Picture picture = ws.Pictures[logopicture];

picture.HeightCM = 1.3;

picture.WidthCM = 6.94;

picture.WidthScale = 75;

picture.HeightScale = 75;

picture.IsLockAspectRatio = true;

picture.RelativeToOriginalPictureSize = true;

picture.Placement = PlacementType.FreeFloating;

picture.Left = 113; // This can't be done



wb.Save(@"Result.xlsx", FileFormatType.Excel2007Xlsx);

Hi,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />

Please try Shapes.AddFreeFloatingShape method. Please see the following documentation link for method parameter details.

Managing Controls

Thank You & Best Regards,