如何以编程方式对 powerpoint 图像进行分组
How to group the power point images programatically
我正在尝试使用 pdf miner 从 pdf 中提取图像 module.I 想将图形图像提取为单个图像,但实际上模块没有返回整个图形图像,而是返回分离的图像 images.I 已将 pdf 转换为 ppt.Then 手动将图形图像分组为单个图像,然后再次转换为 pdf。现在 pdf miner 正在将图形图像提取为单个图像。
我们可以手动对电源点进行分组 images.I 可以通过任何方式以编程方式进行
为此,您需要能够提供一些条件来唯一标识您的形状;它们可能是幻灯片上唯一的图片形状,空白幻灯片上的唯一形状,或者在您第一次计算幻灯片上的形状数量后添加的任何形状。一旦你有了一个条件,你就可以应用它可以构建一个满足条件的形状数组,然后将它们分组:
Sub GroupCertainShapes()
Dim x As Long
Dim sTemp As String
Dim aShapeList() As String
Dim lShapeCount As Long
With ActivePresentation.Slides(1)
' iterate through all shapes on the slide
' to get a count of shapes that meet our condition
For x = 1 To .Shapes.Count
' Does the shape meet our condition? count it.
If .Shapes(x).Type = msoAutoShape Then
lShapeCount = lShapeCount + 1
End If
Next
' now we know how many elements to include in our array,
' so redim it:
ReDim aShapeList(1 To lShapeCount)
' Reset the shape counter
lShapeCount = 0
' Now add the shapes that meet our condition
' to the array:
For x = 1 To .Shapes.Count
' apply some criterion for including the shape or not
If .Shapes(x).Type = msoAutoShape Then
lShapeCount = lShapeCount + 1
aShapeList(lShapeCount) = .Shapes(x).Name
End If
Next
' and finally form a group from the shapes in the array:
If UBound(aShapeList) > 0 Then
.Shapes.Range(aShapeList).Group
End If
End With
End Sub
我正在尝试使用 pdf miner 从 pdf 中提取图像 module.I 想将图形图像提取为单个图像,但实际上模块没有返回整个图形图像,而是返回分离的图像 images.I 已将 pdf 转换为 ppt.Then 手动将图形图像分组为单个图像,然后再次转换为 pdf。现在 pdf miner 正在将图形图像提取为单个图像。
我们可以手动对电源点进行分组 images.I 可以通过任何方式以编程方式进行
为此,您需要能够提供一些条件来唯一标识您的形状;它们可能是幻灯片上唯一的图片形状,空白幻灯片上的唯一形状,或者在您第一次计算幻灯片上的形状数量后添加的任何形状。一旦你有了一个条件,你就可以应用它可以构建一个满足条件的形状数组,然后将它们分组:
Sub GroupCertainShapes()
Dim x As Long
Dim sTemp As String
Dim aShapeList() As String
Dim lShapeCount As Long
With ActivePresentation.Slides(1)
' iterate through all shapes on the slide
' to get a count of shapes that meet our condition
For x = 1 To .Shapes.Count
' Does the shape meet our condition? count it.
If .Shapes(x).Type = msoAutoShape Then
lShapeCount = lShapeCount + 1
End If
Next
' now we know how many elements to include in our array,
' so redim it:
ReDim aShapeList(1 To lShapeCount)
' Reset the shape counter
lShapeCount = 0
' Now add the shapes that meet our condition
' to the array:
For x = 1 To .Shapes.Count
' apply some criterion for including the shape or not
If .Shapes(x).Type = msoAutoShape Then
lShapeCount = lShapeCount + 1
aShapeList(lShapeCount) = .Shapes(x).Name
End If
Next
' and finally form a group from the shapes in the array:
If UBound(aShapeList) > 0 Then
.Shapes.Range(aShapeList).Group
End If
End With
End Sub