[英]Is it possible to check if a slide in one PowerPoint presentation is the same as a slide in another deck?
I need to be able to determine whether (some) slides in two presentations are identical. 我需要能够确定两个演示文稿中的(某些)幻灯片是否相同。 Essentially a master presentation is updated every month and the previous version archived.
基本上每月更新一次主演示文稿,并存档以前的版本。 The slide order remains the same, just the content of those slides may have changed.
幻灯片顺序保持不变,只是这些幻灯片的内容可能已更改。 The trouble is...
麻烦是......
deck1.Slides(i)=deck2.Slides(i)
...doesn't work, and ... ......不起作用,......
deck1.Slides(i).SlideID=deck2.Slides(i).SlideID
...returns identical values even if the slide content has changed. ...即使幻灯片内容已更改,也会返回相同的值。
I was wondering whether it is possible to checksum slides, but I haven't found anything online that would accomplish this -- the VBA checksum routines I've come across including on here are for text strings only. 我想知道校验和幻灯片是否可能,但是我没有在网上找到任何可以实现这一点的东西 - 我遇到的VBA校验和例程包括仅用于文本字符串。 Is it possible to checksum slides or objects, or am I missing something obvious?
校验和幻灯片或对象是否可能,或者我错过了一些明显的东西?
While this is by no means a ready-to-deploy solution, this might provide a starting point, provided your specific task is to check for changed text-contents in seemingly identical presentations. 虽然这绝不是一个可随时部署的解决方案,但这可能提供一个起点,前提是您的具体任务是在看似相同的演示文稿中检查已更改的文本内容。
I narrowed this down to comparing the text-contents of Textboxes (shape-type 14) on Slide 1 for this demonstration. 我将其缩小到比较幻灯片1上文本框(形状类型14)的文本内容以进行此演示。
Sub Neu()
Dim ppt As New PowerPoint.Application
Dim i As Integer, j As Integer
i = 1
For j = 1 To ppt.Presentations(1).Slides(i).Shapes.Count
If ppt.Presentations(1).Slides(i).Shapes(j).Type = 14 And _
Presentations(2).Slides(i).Shapes(j).Type = 14 Then _
Debug.Print _
ppt.Presentations(1).Slides(i).Shapes(j).TextFrame.TextRange.Text = _
Presentations(2).Slides(i).Shapes(j).TextFrame.TextRange.Text
Next j
End Sub
General Notes: 一般注意事项:
Shape(Index) = Shapes.Count+1
, but you never know what people do to your presentation... Shape(Index) = Shapes.Count+1
,但你永远不知道人们对你的演示做了什么...... Hopefully, someone comes up with a more elegant approach to solving this! 希望有人想出一个更优雅的方法来解决这个问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.