Hi Mark,
The position of the shape can be adjusted through Left and Top Property of ShapeImpl. These properties are measured as pixel units and LeftColumnOffset property is measured in EMU units. The following code snippets illustrates how to position an image.
Code example:
//Positioning a Picture IShape shape = worksheet.Pictures.AddPicture(1,1,GetFullTemplatePath("logo.png")); ShapeImpl shapeImpl = shape as ShapeImpl;
//Positioning a Picture shapeImpl.Left = 20; |
We have also shared a sample for your reference which can be downloaded from following link.
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/InsertImage333251025
To know more about positioning and resizing picture, kindly go through the following UG documentation link.
UG Documentation link: http://help.syncfusion.com/file-formats/xlsio/working-with-pictures#positioning-and-re-sizing-pictures
Regards,
Dilli babu.
Hi Mark,
Regarding shape position:
It is not necessary to calculate column width of preceding column instead you can place the shape to its nearest cell by using LeftColumn and TopRow property. If you want to adjust its position, then set its Left and Top property before setting its cell position. The following code example illustrates this behavior.
Code example:
IShape shape = worksheet.Pictures.AddPicture(GetFullTemplatePath("logo.png")); ShapeImpl shapeImpl = shape as ShapeImpl;
//Positioning a Picture. shapeImpl.Left = 20; shapeImpl.Top = 10;
// Setting the picture to a cell. shapeImpl.LeftColumn = 5; |
We have also shared the sample for your reference which can be downloaded from following link.
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/InsertImage565015846.zip
Regarding EM Units:
LeftColumnOffset property is measured in EM units and it does not depends on font size.
Regards,
Dilli babu.