Powerpoint automation spliiting slides

Hello all,

I have a PPT containing say 25 slides and i would like to split the each slide into seperate file and later after some activites i will be merging the spliited files to one ppt.

Can you please help me in splitting and merging the ppt?

Thanks

Hi @tejas.kotharkar

You can use the below code to split the PPT.

' Variables
Dim pptApp As Application = New Application()
Dim presentation As Presentation = pptApp.Presentations.Open("C:\path\to\your\presentation.pptx")
Dim slideIndex As Integer = 1

For Each slide As Slide In presentation.Slides
    ' Create a new presentation for each slide
    Dim newPresentation As Presentation = pptApp.Presentations.Add()
    slide.Copy()
    newPresentation.Slides.Paste(1)
    
    ' Save the new presentation
    Dim newFilePath As String = Path.Combine("C:\path\to\output\folder", "Slide_" & slideIndex & ".pptx")
    newPresentation.SaveAs(newFilePath)
    newPresentation.Close()
    
    slideIndex += 1
Next

' Close the original presentation
presentation.Close()
pptApp.Quit()

Make sure you UiPath.Presentation.Activities dependency installed and GO to Imports Panel and Import Microsoft.Office.Interop.PowerPoint.

Hope it helps!!

@tejas.kotharkar

Please refer this once

HI,

Merge

Split (Copy file in advance, then delete unnecessary slides)

Sample
Sample20240701-6.zip (54.2 KB)

Regards,

I m unable to open the zip file as the version you have used is higher one…n i m using lower version 22.10

Hi,

I removed unnecessary package. Can you try this?

Sample
Sample20240701-6 (2).zip (54.1 KB)

If still cannot open it, can you try the following step?

  • Rename (or remove) project.json
  • Open Main.xaml (Please check if it’s open as Windows project(not Windows legacy)
  • Add UiPath.Presentation.Activiites package v1.13.1 manually via ManagePackage.

Regards,

I m able to run the script now but there seems to be some issue. its not spliiting or merging as per the requirement.

As its not looping properly.

As i want to split all the slides from a ppt to a certain folder and the split folder should be 1slide 2slide 3slide etc. and this should be a file i.e ppt

Hi,

The above is just concept sample. If you need to split a pptx file to each page, the following will help you.

Sample
Sample20240701-6 (3).zip (28.8 KB)

Regards,

Thanks a lot… I will check and work on it…

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.