How to reorder Slides position in PowerPoint Presentation in PHP using Aspose.Slides REST API

I’m trying to get PostSlidesReorderPosition working, but I can’t get any result so far and the documentation doesn’t help me:
https://apireference.aspose.cloud/slides/#!/Slides/PostSlidesReorderPosition

It seems like there are 5 fields to specify the slide position. It certainly makes sense to specify the position in the source and target file, but I don’t understand the need for 5 fields. Two of them have the same description by the way. Is there a complete and working example?

This is what I tried: Success: Reorder presentation slides. name ‘1536236651-example.pptx’,oldPosition ‘’,newPosition ‘’,slideToCopy ‘’,position ‘1’,slideToClone ‘’,source ‘1536236977-1.pptx’,password ‘’,folder ‘’,storage ‘’,layoutAlias ‘’

But my storage file hasn’t changed after this call. The file date has changed, but I can’t see the new slide in the storage file. I’m basically trying to insert one slide into an existing file.

image.png (5.0 KB)

@remolaubacher

POST /slides/{name}/slides API serves number of purposes.

Following are some of the examples of the API:

  1. Add a first slide of presentation ‘Cardio2_DEU_v2.pptx’ to ‘sample-input.pptx’ at position 3.
    Parameter values are:
    name = sample-input.pptx
    slideToCopy = 1
    position = 3
    source = Cardio2_DEU_v2.pptx
    and the Output File: sample-input_Output.pptx

  2. Changing position of a slide from 3 to 1
    POST https://api.aspose.cloud/v1.1/slides/myPresentation.pptx/slides?oldPosition=3&newPosition=1

  3. Create a copy of the second slide and insert to the third position.
    POST https://api.aspose.cloud/v1.1/slides/myPresentation.pptx/slides?position=3&slideToClone=2

  4. Add a copy of the first slide to the end of slides list.
    POST https://api.aspose.cloud/v1.1/slides/myPresentation.pptx/slides?slideToClone=1

  5. Add slide to the specified position. If the position is greater than the count of slides then slide will be added to the end of the slides list.
    POST https://api.aspose.cloud/v1.1/slides/myPresentation.pptx/slides?position=1&layoutAlias=1

The layoutAlias parameter is alias of layout slide for a new slide. Alias could be the type of layout, name of layout slide or index. The type of layout value could be one of the following:

Title, Text, TwoColumnText, Table, TextAndChart, ChartAndText, Diagram, Chart, TextAndClipArt, ClipArtAndText, TitleOnly, Blank, TextAndObject, ObjectAndText, Object, TitleAndObject, TextAndMedia, MediaAndText, ObjectOverText, TextOverObject, TextAndTwoObjects, TwoObjectsAndText, TwoObjectsOverText, FourObjects, VerticalText, ClipArtAndVerticalText, VerticalTitleAndText, VerticalTitleAndTextOverChart, TwoObjects, ObjectAndTwoObject, TwoObjectsAndObject, SectionHeader, TwoTextAndTwoObjects, TitleObjectAndCaption, PictureAndCaption, Custom

We hope this helps!

Thanks @sohail.aspose this works fine! I think I made a mistake because our tools use a zero based index for lists, that’s why slideToCopy was empty in my case.

Your examples definitely helped me to understand things a bit better!

1 Like