简体   繁体   English

将更多的 PowerPoint 演示文稿合并到一个新的演示文稿中,并保留 Lotusscript 中的原始幻灯片布局

[英]Join more powerpoint presentations into one new presentation keeping the originally slide-layout in Lotusscript

I am working on a project that joins two or more pp presentations into one new presentation.我正在开展一个项目,该项目将两个或多个 pp 演示文稿合并为一个新演示文稿。 The selection of the original pp presentations is in a webbased Lotus Notes xPage and after the submit, Lotusscript talkes to the OLE Powerpoint object.原始 pp 演示文稿的选择位于基于 Web 的 Lotus Notes xPage 中,提交后,Lotusscript 与 OLE Powerpoint 对象对话。 Adding the slides into the new Presentation in the right order is no problem.以正确的顺序将幻灯片添加到新的演示文稿中是没有问题的。 The problem is that after the adding the original connection with the slides Template(s) is lost.问题是在添加与幻灯片模板的原始连接后丢失了。

To solve this I found the next codesnippet:为了解决这个问题,我找到了下一个代码片段:

Sub joiner()
 Dim sFileName As String
 Dim oDonor As Variant
 Dim otarget As Variant
 Dim i As Integer
 On Error GoTo errhandler

 Set otarget = ActivePresentation

 Do While sFileName <> ""
 Set oDonor = Presentations.Open(Environ("USERPROFILE") & "\Desktop\joiner\" &     sFileName, msoFalse)

 For i = 1 To oDonor.Slides.Count
 oDonor.Slides(i).Copy

 With otarget.Slides.Paste(otarget.Slides.Count + 1)
 .Design = oDonor.Slides(i).Design
 .ColorScheme = oDonor.Slides(i).ColorScheme
 End With

 Next i

 oDonor.Close
 Set oDonor = Nothing
 sFileName = Dir()
 Loop

 End Sub

I have to declare the presentations oDonor and oTarget as a Variant because lotusscript doesn't understand Dim oTarget As Presentation我必须将演示文稿 oDonor 和 oTarget 声明为变体,因为 lotusscript 不理解Dim oTarget As Presentation

This is probably the reason why the code returns a typemismatch error at: .Design = oDonor.Slides(i).Design这可能是代码在以下位置返回类型不匹配错误的原因: .Design = oDonor.Slides(i).Design

My questions are:我的问题是:

  1. Am I doing the join the right way or is there a better solution?我是在以正确的方式加入还是有更好的解决方案?
  2. Is there a solution for the typemismatch error?有没有解决 typemismatch 错误的方法?

*ps: The result presentation doesn't have to be editable, so maybe it is not necessary to add templates. *ps:结果展示不一定是可编辑的,所以也许没有必要添加模板。

Update 04-10-2012: The next code solves the template problem. 2012 年 4 月 10 日更新:下一个代码解决了模板问题。 What still is missing now is the background image used by some slides.现在仍然缺少的是某些幻灯片使用的背景图像。 See: https://stackoverflow.com/questions/12731691/how-to-export-a-backgroundimage-of-a-slide-to-the-filesystem请参阅: https : //stackoverflow.com/questions/12731691/how-to-export-a-backgroundimage-of-a-slide-to-the-filesystem

Dim oDonor As Variant
Dim h As Integer
Dim thetmplt As Variant
Dim thetmpltname As String
Dim thetmpltnew As Variant
Dim thetmpltnamenew As String

Set oDonor = PPApplication.Presentations.Open(tempdirectory +
jobid+CStr(filenamearray  (i)),False,False,False)

thetmplt = oDonor.TemplateName  
Call oDonor.SaveAs(tempdirectory +jobid+CStr(i)+ thetmplt+".pot" ,5, -1)

For h = 1 To oDonor.Slides.Count

Dim oTargetSlide As Variant         

oDonor.Slides(h).Copy
Set oTargetSlide =  newPres.Slides.Paste()


Next        

Dim theubound As Variant
theubound = oDonor.Slides.Count
ReDim thearray(1 To k + theubound) As Variant


For k = k To k + oDonor.Slides.Count-1

thearray(k) = k
Next

Call newPres.Slides.Range(thearray()).ApplyTemplate(tempdirectory +
jobid+CStr(i+thetmplt+".pot")

oDonor.Close
Set oDonor = Nothing

This is just a hunch, but try:这只是一种预感,但请尝试:

Dim oTargetSlide as Variant
Set oTargetSlide =  otarget.Slides.Paste(otarget.Slides.Count + 1)(1)
With oTargetSlide
 .Design = oDonor.Slides(i).Design
 .ColorScheme = oDonor.Slides(i).ColorScheme
 End With

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PowerPoint VBA:如何将每张幻灯片单独保存为新演示文稿? - PowerPoint VBA: How to save each slide individually as new presentations? 是否可以检查一个PowerPoint演示文稿中的幻灯片是否与另一个套牌中的幻灯片相同? - Is it possible to check if a slide in one PowerPoint presentation is the same as a slide in another deck? 如何逐张合并 2 个 PowerPoint 演示文稿? - How to combine 2 PowerPoint presentations slide by slide? 在 PowerPoint 演示文稿中复制幻灯片 - Duplicating a slide in PowerPoint presentation Select 基于幻灯片标签的 Powerpoint 幻灯片并复制到新的演示文稿中 - Select Powerpoint slides based on the slide tags and copy into a new presentation 在VBA powerpoint中如何将新幻灯片添加到空的演示文稿中 - in VBA powerpoint How to add a new slide to an empty presentation Powerpoint幻灯片:如何将我在一张幻灯片上的组合框和文本框控件复制到另一张相同演示文稿的幻灯片上? - Powerpoint slides: how to copy my combobox and textbox controls on one slide to a another slide, same presentation? 有没有直接的方法来获取PowerPoint演示文稿中幻灯片的索引? - Is there a direct way to get the index of a slide in a PowerPoint presentation? 使用Master通过自定义布局在VBA for PowerPoint 2010中创建新幻灯片 - Create a new slide in VBA for PowerPoint 2010 with custom layout using Master 在多个打开的演示文稿中替换一张幻灯片 - Replacing one slide in several open presentations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM