Delete Shapes from a Slide Introduction
With Aspose.Slides Cloud, you can easily delete shapes from a PowerPoint presentation. The following methods allow you to delete shapes at specified indices or all shapes at once from a slide. The methods return information about the remaining shapes.
DeleteShape
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}
DELETE
Deletes a shape from a presentation slide.
DeleteShape
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 contaning the shapes.
shapeIndex
integer
path
true
The 1-based index of the shape to delete.
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
.
subShape
string
query
false
Sub-shape path (e.g. “3”, “3/shapes/2”)
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
MyFolder/MyPresentation.pptx document contains three shapes on the first slide. Delete the second shape.
cURL Solution
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System ;
class Application
{
static void Main ( )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var remainingShapes = slidesApi . DeleteShape ( "MyPresentation.pptx" , 1 , 2 , null , "MyFolder" );
foreach ( var shape in remainingShapes . ShapesLinks )
{
Console . WriteLine ( shape . 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 ( "MyClientId" , "MyClientSecret" );
Shapes remainingShapes = slidesApi . deleteShape ( "MyPresentation.pptx" , 1 , 2 , null , "MyFolder" , null , null );
for ( ResourceUri shape : remainingShapes . getShapesLinks ()) {
System . out . println ( shape . getHref ());
}
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "MyClientId" );
$configuration -> setAppKey ( "MyClientSecret" );
$slidesApi = new SlidesApi ( null , $configuration );
$remainingShapes = $slidesApi -> deleteShape ( "MyPresentation.pptx" , 1 , 2 , null , "MyFolder" );
foreach ( $remainingShapes -> getShapesLinks () as $shape ) {
echo $shape -> getHref (), " \n " ;
}
Ruby
Copy
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi . new ( configuration )
remaining_shapes = slides_api . delete_shape ( "MyPresentation.pptx" , 1 , 2 , nil , "MyFolder" )
for shape in remaining_shapes . shapes_links
puts shape . href
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
remaining_shapes = slides_api . delete_shape ( "MyPresentation.pptx" , 1 , 2 , None , "MyFolder" )
for shape in remaining_shapes . shapes_links :
print ( shape . href )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
slidesApi . deleteShape ( "MyPresentation.pptx" , 1 , 2 , null , "MyFolder" ). then ( remainingShapes => {
remainingShapes . body . shapesLinks . forEach ( shape => {
console . log ( shape . href );
});
});
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( L "MyClientId" , L "MyClientSecret" );
auto remainingShapes = slidesApi -> deleteShape ( L "MyPresentation.pptx" , 1 , 2 , L "" , L "MyFolder" ). get ();
for ( auto shape : remainingShapes -> getShapesLinks ()) {
std :: wcout << shape -> getHref () << std :: endl ;
}
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my %parameters = ( name => "MyPresentation.pptx" , slide_index => 1 , shape_index => 2 , folder => "MyFolder" );
my $remaining_shapes = $slides_api -> delete_shape ( %parameters );
for $shape ( @ { $remaining_shapes -> { shapes_links }}) {
print $shape -> { href }, "\n" ;
}
Swift
Go
DeleteShapes
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/shapes
DELETE
Deletes shapes from a presentation slide.
DeleteShapes
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 contaning the shapes.
shapes
string
query
false
The 1-based indices of the shapes to delete. Delete all by default.
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 document contains three shapes on the first slide. Delete the first and third shapes.
cURL Solution
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System ;
using System.Collections.Generic ;
class Application
{
static void Main ( )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var shapeIndices = new List < int > { 1 , 3 };
var remainingShapes = slidesApi . DeleteShapes ( "MyPresentation.pptx" , 1 , shapeIndices , null , "MyFolder" );
foreach ( var shape in remainingShapes . ShapesLinks )
{
Console . WriteLine ( shape . 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 slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
ArrayList shapeIndices = new ArrayList ( Arrays . asList ( 1 , 3 ));
Shapes remainingShapes = slidesApi . deleteShapes ( "MyPresentation.pptx" , 1 , shapeIndices , null , "MyFolder" , null , null );
for ( ResourceUri shape : remainingShapes . getShapesLinks ()) {
System . out . println ( shape . getHref ());
}
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "MyClientId" );
$configuration -> setAppKey ( "MyClientSecret" );
$slidesApi = new SlidesApi ( null , $configuration );
$remainingShapes = $slidesApi -> deleteShapes ( "MyPresentation.pptx" , 1 , [ 1 , 3 ], null , "MyFolder" );
foreach ( $remainingShapes -> getShapesLinks () as $shape ) {
echo $shape -> getHref (), " \n " ;
}
Ruby
Copy
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi . new ( configuration )
remaining_shapes = slides_api . delete_shapes ( "MyPresentation.pptx" , 1 , [ 1 , 3 ] , nil , "MyFolder" )
for shape in remaining_shapes . shapes_links
puts shape . href
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
remaining_shapes = slides_api . delete_shapes ( "MyPresentation.pptx" , 1 , [ 1 , 3 ], None , "MyFolder" )
for shape in remaining_shapes . shapes_links :
print ( shape . href )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
slidesApi . deleteShapes ( "MyPresentation.pptx" , 1 , [ 1 , 3 ], null , "MyFolder" ). then ( remainingShapes => {
remainingShapes . body . shapesLinks . forEach ( shape => {
console . log ( shape . href );
});
});
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( L "MyClientId" , L "MyClientSecret" );
auto remainingShapes = slidesApi -> deleteShapes ( L "MyPresentation.pptx" , 1 , { 1 , 3 }, L "" , L "MyFolder" ). get ();
for ( auto shape : remainingShapes -> getShapesLinks ()) {
std :: wcout << shape -> getHref () << std :: endl ;
}
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my @shape_indices = ( 1 , 3 );
my %parameters = ( name => "MyPresentation.pptx" , slide_index => 1 , shapes => \ @shape_indices , folder => "MyFolder" );
my $remaining_shapes = $slides_api -> delete_shapes ( %parameters );
for $shape ( @ { $remaining_shapes -> { shapes_links }}) {
print $shape -> { href }, "\n" ;
}
Swift
Go
SDKs
Check Available SDKs to learn how to add an SDK to your project.