用于在 Powerpoint 2010 中将方程转换为图像的宏 [英] Macro to convert equations into images in Powerpoint 2010
问题描述
我正在尝试准备一个宏,将 PowerPoint2010 演示文稿中的所有方程转换为图像,同时保留位置和动画效果/顺序.
I am trying to preapre a macro that would convert all equations in a PowerPoint2010 presentation into images while retaining the position and animation effect/order.
基于在此处提供的提示(感谢Steve Rindsberg),我修改了脚本如下:
Based on the tip provided here (thanks to Steve Rindsberg), I have modified the script as below:
Sub ConvertAllShapesToPic()
Dim oSl As Slide
Dim oSh As Shape
On Error Resume Next
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
' modify the following depending on what you want to
' convert
Select Case oSh.Type
Case msoTextBox, msoEmbeddedOLEObject, msoLinkedOLEObject
ConvertShapeToPic oSh
Case Else
End Select
Next
Next
NormalExit:
Exit Sub
ErrorHandler:
Resume Next
End Sub
Sub ConvertShapeToPic(ByRef oSh As Shape)
Dim oNewSh As Shape
Dim oSl As Slide
Set oSl = oSh.Parent
oSh.Copy
Set oNewSh = oSl.Shapes.PasteSpecial(ppPasteEnhancedMetafile)(1)
oSh.PickupAnimation
oNewSh.ApplyAnimation
With oNewSh
.Left = oSh.Left
.Top = oSh.Top
Do
.ZOrder (msoSendBackward)
Loop Until .ZOrderPosition = .ZOrderPosition
.AnimationSettings.AnimationOrder = oSh.AnimationSettings.AnimationOrder
End With
oSh.Delete
NormalExit:
Exit Sub
ErrorHandler:
Resume Next
End Sub
此脚本的问题:
- 所有方程都没有转换成图像.
- 一些没有方程的文本框失去了它们的内部动画效果(例如在点击时显示第二个项目符号文本).
我准备这个脚本的原因是,当我将 PowerPoint 2010 转换为 Articulate 演示文稿时,由于 Articulate 09 不完全支持 PPT2010 方程,因此无法正确呈现方程.
My reason for preparing this script is because when I convert PowerPoint 2010 into Articulate presentations, the equations are not getting rendered properly since Articulate 09 does not fully support PPT2010 equations.
我有 100 多个 PPT,几乎所有幻灯片上都有方程式.如果没有编程方法,唯一的选择就是手动转换所有方程并重新应用动画效果!
I have more than 100 PPTs, with equations on nearly all slides. Without a programmatic method, the only option would be to convert all the equations manually and reapply the anim effects!
感谢您提供的任何帮助:-)
Appreciate any help that you can offer :-)
谢谢!
推荐答案
至于第一个问题,我的不好:
As to the first problem, my bad:
为此:
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
' modify the following depending on what you want to
' convert
Select Case oSh.Type
Case msoTextBox, msoEmbeddedOLEObject, msoLinkedOLEObject
ConvertShapeToPic oSh
Case Else
End Select
Next
Next
替换:
Dim x as long
For x = ActivePresentation.Slides.Count to 1 Step -1
Set oSl = ActivePresentation.Slides(x)
For Each oSh In oSl.Shapes
' modify the following depending on what you want to
' convert
Select Case oSh.Type
Case msoTextBox, msoEmbeddedOLEObject, msoLinkedOLEObject
ConvertShapeToPic oSh
Case Else
End Select
Next
Next
当我最初写这篇文章时,我可能只用每张幻灯片一个方程来测试幻灯片.当您单步执行集合并可能删除成员时,您需要向后单步执行,否则删除成员时索引会变得混乱.
I probably only tested slides with one equation per slide when I wrote this originally. When you step through a collection and possible delete members, you need to step through backwards, else the indexing gets messed up when you delete a member.
这篇关于用于在 Powerpoint 2010 中将方程转换为图像的宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!