结合PPT

时间:2017-11-22 10:13:21

标签: vba powerpoint powerpoint-vba

我已经找到,更正并测试了用于处理Powerpoint中的图表的代码片段。

第一部分是使地块大小相同并正确定位(假设幻灯片上有两个地块)并且如下所示:

Sub ProcessAllSlides()

Dim sld As Slide
Dim Shp As Shape

For Each sld In ActivePresentation.Slides
    Call SetChartSizeAndPosition(sld.Shapes(1), 30, 120, 320, 240)
    Call SetChartSizeAndPosition(sld.Shapes(2), 370, 120, 320, 240)
Next

End Sub

Sub SetChartSizeAndPosition(Shp As Shape, Left As Single, Top As Single, Width As Single, Height As Single)

With Shp
    .Left = Left
    .Top = Top
    .Width = Width
    .Height = Height
End With

End Sub

这适用于演示文稿中的所有幻灯片。我希望它只能在活动幻灯片上运行。

第二部分应该格式化绘图区域(而不是图表区域)。见下文:

Sub SizePlotArea()

Dim oSld As Slide
Dim oCht As Chart

Set oCht = ActiveWindow.Selection.ShapeRange(1).Chart

With oCht.PlotArea
    ' Edit these values as needed
    ' Change the following lines to e.g. Msgbox .Left etc
    ' to get the values of the chart you want to match others TO
    .Left = 0
    .Top = 0
    .Height = 220
    .Width = 300
End With

End Sub

Idealy我希望将两者结合起来,以便在活动幻灯片上为所有(两个)图表完成它们。

有任何提示的人吗?

1 个答案:

答案 0 :(得分:1)

尝试下面的合并 FILE *fw = fopen("LinkedListArray.bin", "rb"); long pos = ftell(fw); fseek(fw, 0, SEEK_END); long length = ftell(fw); fseek(fw, pos, SEEK_SET); fread(hashMap, (size_t) length, 1, fw); ,解释代码中的注释。

Sub