interop Shapes.AddPicture creates incorrect dimens

2019-08-27 07:15发布

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.

1条回答
Animai°情兽
2楼-- · 2019-08-27 08:05

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

查看更多
登录 后发表回答