How to start a Powerpoint presentation using ACT?

Options
Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 419
5 Likes First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

Start a presentation in ACT Console.

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 419
    5 Likes First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    This can be done by importing Microsoft.Office.Interop.PowerPoint library.

    # Import Powerpoint Lib.
    import clr
    clr.AddReference("Microsoft.Office.Interop.PowerPoint")
    import Microsoft.Office.Interop.PowerPoint as PowerPoint
    # Create powerpoint application
    powerpoint = PowerPoint.ApplicationClass()
    powerpoint.Visible = True
    # Add presentation to the application
    presentation=powerpoint.Presentations.Add()
    # Save the presentation
    presentation.SaveAs(r"D:\Path\to\myppt.pptx", PowerPoint.PpSaveAsFileType.ppSaveAsDefault)