Search code examples
c#interoppowerpointoffice-interop

interop Shapes.AddPicture creates incorrect dimension for image


I am using interop to create powerpoint presentation.i use Shapes.AddPicture to add images to slide.

Shapes.AddPicture(strImagePath, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Convert.ToInt32(shape.Left), Convert.ToInt32(shape.Top), Convert.ToInt32(xmlTempNode.Attributes["imgwidth"].Value), Convert.ToInt32(xmlTempNode.Attributes["imgheight"].Value));//load new image to shape

i am passing imageheight as 127, however final slide contains image with imageheight as 167.

Any help would be appreciated.


Solution

  • It seems that you're expecting that PowerPoint uses pixels as its dimensions; it doesn't. It uses points, 72 points to the inch.