0
我正在使用此处找到的解决方案(Converting PowerPoint charts to images)将PowerPoint中的图表转换为图像。Conver Chart to Image PowerPoint
解决方案完美地工作,但是当转换发生时,我想让图片“保持”在与原始图表相同的位置和维度。
这可能吗?
我正在使用此处找到的解决方案(Converting PowerPoint charts to images)将PowerPoint中的图表转换为图像。Conver Chart to Image PowerPoint
解决方案完美地工作,但是当转换发生时,我想让图片“保持”在与原始图表相同的位置和维度。
这可能吗?
其实解决方法很简单。必须记住形状的高度和Widht。
Copy the shape the clipboard, delete it and then paste it back as a vector image
Private Function ReplaceChart(oSld As Slide, oShp As Shape)
Dim shpTop As Single
Dim shpleft As Single
Dim shpWidth As Single
Dim shpHeight As Single
' Save the chart position
shpTop = oShp.Top
shpleft = oShp.Left
shpWidth = oShp.Width
shpHeight = oShp.Height
' Copy, delete and paste the shape back as a picture
oShp.Copy
oShp.Delete
ActiveWindow.View.PasteSpecial ppPasteEnhancedMetafile
' Get a reference to the new picture which will be the last shape in the shapes collection
Set oShp = oSld.Shapes(oSld.Shapes.Count)
' Restore the chart picture position
oShp.Top = shpTop
oShp.Left = shpleft
oShp.Width = shpWidth
oShp.Height = shpHeight