interop Shapes.AddPicture creates incorrect dimension for image

五迷三道 提交于 2019-12-25 05:27:24

问题


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:


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



来源:https://stackoverflow.com/questions/17367575/interop-shapes-addpicture-creates-incorrect-dimension-for-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!