创建具有脚本能力的 Powerpoint/Keynote 演示文稿?

发布于 2024-08-17 07:30:57 字数 646 浏览 3 评论 0原文

最近我一直在为公司制作 PowerPoint 演示文稿。我主要是在 PowerPoint 中完成此操作。基本上,它们是通过相同的设计创建的,但只是设置位置的数字不同,以及用于生成 PowerPoint 条形图/饼图内容的不同数字。 (插入时基本上有这些饼图对象,为您提供更改设计的选项,并在弹出的一些 Excel 电子表格中输入数字)。

假设我正在为 100 家公司执行此操作:是否有一种方法可以指定我需要的所有不同值,并以某种方式创建幻灯片?我可以提供一个设计基础,它所需要做的就是进入并更改动态值(无光栅)。

对于 PowerPoint 来说,这甚至不一定是一个问题:如果我可以使用 Keynote 来完成此操作(例如,自动绘制饼图、条形图以及使用数字和静态文本设置位置),那么这也可以。

编辑:我提到我知道 PowerPoint 饼图/条形图是从 Xxcel 电子表格生成的。在我的演示文稿中,大约有 3 个这样的值,以及静态位置上的其他变化值,分布在 100 个左右的演示文稿中。我希望编写全部或大部分过程的脚本。

编辑:使用 PowerPoint 2007 或最新版本的 Keynote。使用 Keynote 编写脚本的首选方法可能是 AppleScript,使用 PowerPoint 2007,Python/Django 或宏。

Lately I have been creating PowerPoint presentations to companies. I have mostly been doing this in PowerPoint. Basically they are created by the same design, but just different numbers in set places, and different numbers used to generate the PowerPoint bar graph / pie graph stuff. (basically there are these pie graph objects when inserted, give you an option to change the design, and input the numbers in some excel spreadsheet that pops up).

Let's say I'm doing this for 100 companies: isn't there a way to just specify all the different values I need, and have the powerpoint created somehow? I can provide a design base, all it needs to do is just go in and change dynamic values (nothing raster).

This isn't even a question necessarily for PowerPoint: if I could do this with Keynote (as in, automate pie graphs, bar graphs, and set places with numbers & static text), then that works too.

Edit: I mentioned that I know that PowerPoint pie graphs / bar graphs are generated from Xxcel spreadsheets. There are about 3 of these in my presentation, along with other changing values in static positions, across 100 or so presentations. I am looking to script all or the majority of the process.

Edit: Using PowerPoint 2007, or the newest version of Keynote. Preferred method of scripting with Keynote would probably be AppleScript, with PowerPoint 2007, either Python/Django or macros.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫弦 2024-08-24 07:30:57

抱歉,我需要几天时间才能回复您,需要解决一个问题。这是一种快速有效的方法来完成您的要求。

  1. 创建启用宏的 PowerPoint。
  2. 创建一个饼图
    通过插入|图表的第一张幻灯片
    功能区中的命令。 Excel 将
    打开。在列中,在水平(类别)轴上保持原样(即第一季度、第二季度等)。在图例条目(系列)轴上,展开几列并添加更多数据。确保列名称是唯一的。
  3. 关闭 Excel
  4. 按 Alt+F11 转到 VBE。
  5. 将以下代码复制/粘贴到新的
    模块,更改以下内容
    变量:chartTemplatePath 以及,
    如果需要,sc.Name,某物
    其他你选择的。
  6. 在子程序中点击F5运行。
    您现在应该有尽可能多的图表
    幻灯片就像有列一样。

Sub CreateChartDecksandSave()
    Dim chartTemplatePath As String
    chartTemplatePath = "C:\Temp\"

    Dim myPPT As Presentation
    Set myPPT = ActivePresentation

    Dim mainChart As Chart
    Set mainChart = myPPT.Slides(1).Shapes(1).Chart

    Dim scCount As Integer
    scCount = mainChart.SeriesCollection.Count

    Dim sc As Series

    For i = 1 To scCount
        Set sc = mainChart.SeriesCollection(1)
        myPPT.SaveCopyAs (chartTemplatePath & sc.Name & ".pptx")
        sc.Delete
    Next
End Sub

如果您正在使用此工具并且图表数据从主 PPT 中消失,没关系,只需选择图表,转到图表工具 | 设计 | 选择数据并重新选择您的数据集作为整个表格。

Sorry this has taken a few days to get back to you, had to work out an issue. Here's a quick and efficient way to do what you're asking for.

  1. Create a macro-enabled PowerPoint.
  2. Create a single pie chart on the
    first slide via the Insert|Chart
    command in the Ribbon. Excel will
    open. In the columns, on the Horizontal (Category) Axis leave as is (i.e. 1st Qtr, 2nd Qrt, etc.). On the Legend Entries (Series) Axis, expand a few columns and add more data. Ensure column names are unique.
  3. Close Excel
  4. Press Alt+F11 to go to the VBE.
  5. Copy/Paste the code below into a new
    module, changing the following
    variables: chartTemplatePath and,
    if needed, sc.Name, to something
    else of your choosing.
  6. Click F5 in the subroutine to run.
    You should now have as many charts
    slides as there are columns.

.

Sub CreateChartDecksandSave()
    Dim chartTemplatePath As String
    chartTemplatePath = "C:\Temp\"

    Dim myPPT As Presentation
    Set myPPT = ActivePresentation

    Dim mainChart As Chart
    Set mainChart = myPPT.Slides(1).Shapes(1).Chart

    Dim scCount As Integer
    scCount = mainChart.SeriesCollection.Count

    Dim sc As Series

    For i = 1 To scCount
        Set sc = mainChart.SeriesCollection(1)
        myPPT.SaveCopyAs (chartTemplatePath & sc.Name & ".pptx")
        sc.Delete
    Next
End Sub

If you're working with this and the chart data disappears from the main PPT, that's okay, just select the chart, go to Chart Tools | Design | Select Data and reselect your data set as the whole table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文