Move a Slide Introduction
Aspose.Slides Cloud lets you move a slide to a new position within a PowerPoint presentation. The following methods allow you to both move a single slide and change the order of multiple slides at the same time.
MoveSlide
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/move
POST
Moves a presentation slide to a new position.
MoveSlide
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The name of a presentation file.
slideIndex
integer
path
true
The 1-based index of the slide to be moved.
newPosition
integer
query
true
The new index for the slide.
password
string
header
false
The password to open the presentation.
folder
string
query
false
The path to the folder containing the presentation.
storage
string
query
false
The name of the storage contaning the folder
.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
MyFolder/MyPresentation.pptx file saved to MyStorage contains four slides. Move the third slide to the first position.
cURL Solution
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System ;
class Application
{
static void Main ( )
{
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var response = api . MoveSlide ( "MyPresentation.pptx" , 3 , 1 );
foreach ( var resourceUri in response . SlideList )
{
Console . WriteLine ( resourceUri . Href );
}
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
Slides response = slidesApi . moveSlide ( "MyPresentation.pptx" , 3 , 1 , null , "MyFolder" , "MyStorage" );
for ( ResourceUri resourceUri : response . getSlideList ()) {
System . out . println ( resourceUri . getHref ());
}
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "my_client_id" );
$configuration -> setAppKey ( "my_client_secret" );
$slidesApi = new SlidesApi ( null , $configuration );
$response = $slidesApi -> moveSlide ( "MyPresentation.pptx" , 3 , 1 , null , "MyFolder" , "MyStorage" );
foreach ( $response -> getSlideList () as $resourceUri ) {
echo $resourceUri -> getHref (), " \n " ;
}
Ruby
Copy
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "my_client_id"
configuration . app_key = "my_client_secret"
slides_api = SlidesApi . new ( configuration )
response = slides_api . move_slide ( "MyPresentation.pptx" , 3 , 1 , nil , "MyFolder" , "MyStorage" )
for resource_uri in response . slide_list
puts resource_uri . href
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
response = slides_api . move_slide ( "MyPresentation.pptx" , 3 , 1 , None , "MyFolder" , "MyStorage" )
for resource_uri in response . slide_list :
print ( resource_uri . href )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
slidesApi . moveSlide ( "MyPresentation.pptx" , 3 , 1 , null , "MyFolder" , "MyStorage" ). then ( response => {
response . body . slideList . forEach ( resourceUri => {
console . log ( resourceUri . href );
});
});
Android
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
Slides response = slidesApi . moveSlide ( "MyPresentation.pptx" , 3 , 1 , null , "MyFolder" , "MyStorage" );
for ( ResourceUri resourceUri : response . getSlideList ()) {
System . out . println ( resourceUri . getHref ());
}
}
}
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
auto response = slidesApi -> moveSlide ( L "MyPresentation.pptx" , 3 , 1 , L "" , L "MyFolder" , L "MyStorage" ). get ();
for ( auto resourceUri : response -> getSlideList ()) {
std :: wcout << resourceUri -> getHref () << std :: endl ;
}
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "my_client_id" ;
$config -> { app_key } = "my_client_secret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my %parameters = ( name => "MyPresentation.pptx" , slide_index => 3 , new_position => 1 , folder => "MyFolder" , storage => "MyStorage" );
my $response = $slides_api -> move_slide ( %parameters );
for my $resource_uri ( @ { $response -> { slide_list }}) {
print $resource_uri -> { href }, "\n" ;
}
Swift
Go
ReorderSlides
API
Type
Description
Resource
/slides/{name}/slides/reorder
POST
Changes the order of presentation slides.
ReorderSlides
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The name of a presentation file.
oldPositions
string
query
false
A comma separated array of 1-based indices of slides to be reordered.
newPositions
string
query
false
A comma separated array of new slide positions.
password
string
header
false
The password to open the presentation.
folder
string
query
false
The path to the folder containing the presentation.
storage
string
query
false
The name of the storage contaning the folder
.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
MyFolder/MyPresentation.pptx file saved to MyStorage contains three slides. Swap the first and last slides.
cURL Solution
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System ;
using System.Collections.Generic ;
class Application
{
static void Main ( )
{
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var slideIndices = new List < int > { 1 , 3 };
var newPositions = new List < int > { 3 , 1 };
var response = api . ReorderSlides ( "MyPresentation.pptx" , slideIndices , newPositions );
foreach ( var resourceUri in response . SlideList )
{
Console . WriteLine ( resourceUri . Href );
}
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import java.util.Arrays ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
ArrayList slideIndices = new ArrayList ( Arrays . asList ( 1 , 3 ));
ArrayList newPositions = new ArrayList ( Arrays . asList ( 3 , 1 ));
Slides response = api . reorderSlides ( "MyPresentation.pptx" , slideIndices , newPositions , null , null , null );
for ( ResourceUri resourceUri : response . getSlideList ()) {
System . out . println ( resourceUri . getHref ());
}
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "my_client_id" );
$configuration -> setAppKey ( "my_client_secret" );
$slidesApi = new SlidesApi ( null , $configuration );
$response = $slidesApi -> reorderSlides ( "MyPresentation.pptx" , [ 1 , 3 ], [ 3 , 1 ], null , "MyFolder" , "MyStorage" );
foreach ( $response -> getSlideList () as $resourceUri ) {
echo $resourceUri -> getHref (), " \n " ;
}
Ruby
Copy
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "my_client_id"
configuration . app_key = "my_client_secret"
slides_api = SlidesApi . new ( configuration )
response = slides_api . reorder_slides ( "MyPresentation.pptx" , [ 1 , 3 ] , [ 3 , 1 ] , nil , "MyFolder" , "MyStorage" )
for resource_uri in response . slide_list
puts resource_uri . href
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
response = slides_api . reorder_slides ( "MyPresentation.pptx" , [ 1 , 3 ], [ 3 , 1 ], None , "MyFolder" , "MyStorage" )
for resource_uri in response . slide_list :
print ( resource_uri . href )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
slidesApi . reorderSlides ( "MyPresentation.pptx" , [ 1 , 3 ], [ 3 , 1 ], null , "MyFolder" , "MyStorage" ). then ( response => {
response . body . slideList . forEach ( resourceUri => {
console . log ( resourceUri . href );
});
});
Android
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import java.util.Arrays ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
ArrayList slideIndices = new ArrayList ( Arrays . asList ( 1 , 3 ));
ArrayList newPositions = new ArrayList ( Arrays . asList ( 3 , 1 ));
Slides response = slidesApi . reorderSlides ( "MyPresentation.pptx" , slideIndices , newPositions , null , "MyFolder" , "MyStorage" );
for ( ResourceUri resourceUri : response . getSlideList ()) {
System . out . println ( resourceUri . getHref ());
}
}
}
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
auto response = slidesApi -> reorderSlides ( L "MyPresentation.pptx" , { 1 , 3 }, { 3 , 1 }, L "" , L "MyFolder" , L "MyStorage" ). get ();
for ( auto resourceUri : response -> getSlideList ()) {
std :: wcout << resourceUri -> getHref () << std :: endl ;
}
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "my_client_id" ;
$config -> { app_key } = "my_client_secret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my %parameters = ( name => "MyPresentation.pptx" , old_positions => [ 1 , 3 ], new_positions => [ 3 , 1 ], folder => "MyFolder" , storage => "MyStorage" );
my $response = $slides_api -> reorder_slides ( %parameters );
for my $resource_uri ( @ { $response -> { slide_list }}) {
print $resource_uri -> { href }, "\n" ;
}
Swift
Go
SDKs
Using an SDK (API client) is the quickest way for a developer to speed up development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of Aspose.Slides Cloud SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.