[英]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:我的问题是:
*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.