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