Delete Paragraphs Introduction
Deletion of paragraphs typically pertains to editing text blocks in slides. The following methods allow you to delete a specific paragraph or range of paragraphs.
DeleteParagraph
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs/{paragraphIndex}
DELETE
Deletes a paragraph in a shape.
DeleteParagraph
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The presentation file name.
slideIndex
integer
path
true
The 1-based index of the presentation slide.
shapeIndex
integer
path
true
The 1-based index of the shape.
paragraphIndex
integer
path
true
The 1-based index of the paragraph.
password
string
header
false
The password to open the presentation.
folder
string
query
false
The folder where the presentation file is located.
storage
string
query
false
The storage where the presentation file is located.
subShape
string
query
false
The sub-shape path (e.g. “3”, “3/shapes/2”).
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
In the document MyPresentation.pptx , the first slide contains one shape (text box) with three paragraphs. Delete the first paragraph from the shape.
cURL Solution
Request
Get an Access Token
curl POST "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=MyClientId&client_secret=MyClientSecret" \
-H "Content-Type: application/x-www-form-urlencoded"
Delete the Paragraph
curl -X DELETE "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/shapes/1/paragraphs/1" \
-H "authorization: Bearer MyAccessToken"
Response
Response Example
{
"paragraphLinks" : [
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/shapes/1/paragraphs/1" ,
"relation" : "self" ,
"slideIndex" : 1 ,
"shapeIndex" : 1
},
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/shapes/1/paragraphs/2" ,
"relation" : "self" ,
"slideIndex" : 1 ,
"shapeIndex" : 1
}
],
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/shapes/1/paragraphs" ,
"relation" : "self" ,
"slideIndex" : 1 ,
"shapeIndex" : 1
}
}
SDK Solutions
C#
using System ;
using Aspose.Slides.Cloud.Sdk ;
class Application
{
static void Main ( string [] args )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var documentName = "MyPresentation.pptx" ;
var slideIndex = 1 ;
var shapeIndex = 1 ;
var paragraphIndex = 1 ;
var paragraphsInfo = slidesApi . DeleteParagraph ( documentName , slideIndex , shapeIndex , paragraphIndex );
var paragraphCount = paragraphsInfo . ParagraphLinks . Count ;
Console . WriteLine ( "Number of remaining paragraphs: " + paragraphCount ); // 2
}
}
Java
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.Paragraphs ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
String documentName = "MyPresentation.pptx" ;
int slideIndex = 1 ;
int shapeIndex = 1 ;
int paragraphIndex = 1 ;
Paragraphs paragraphsInfo = slidesApi . deleteParagraph ( documentName , slideIndex , shapeIndex , paragraphIndex , null , null , null , null );
int paragraphCount = paragraphsInfo . getParagraphLinks (). size ();
System . out . println ( "Number of remaining paragraphs: " + paragraphCount ); // 2
}
}
PHP
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 );
$documentName = "MyPresentation.pptx" ;
$slideIndex = 1 ;
$shapeIndex = 1 ;
$paragraphIndex = 1 ;
$paragraphsInfo = $slidesApi -> deleteParagraph ( $documentName , $slideIndex , $shapeIndex , $paragraphIndex );
$paragraphCount = count ( $paragraphsInfo -> getParagraphLinks ());
echo "Number of remaining paragraphs: " , $paragraphCount ; // 2
Ruby
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi . new ( configuration )
document_name = "MyPresentation.pptx"
slide_index = 1
shape_index = 1
paragraph_index = 1
paragraphs_info = slides_api . delete_paragraph ( document_name , slide_index , shape_index , paragraph_index )
paragraph_count = paragraphs_info . paragraph_links . length ()
print "Number of remaining paragraphs: " , paragraph_count # 2
Python
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
document_name = "MyPresentation.pptx"
slide_index = 1
shape_index = 1
paragraph_index = 1
paragraphs_info = slides_api . delete_paragraph ( document_name , slide_index , shape_index , paragraph_index )
paragraph_count = len ( paragraphs_info . paragraph_links )
print ( "Number of remaining paragraphs:" , paragraph_count ) # 2
Node.js
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
const documentName = "MyPresentation.pptx" ;
const slideIndex = 1 ;
const shapeIndex = 1 ;
const paragraphIndex = 1 ;
slidesApi . deleteParagraph ( documentName , slideIndex , shapeIndex , paragraphIndex ). then ( paragraphsInfo => {
const paragraphCount = paragraphsInfo . body . paragraphLinks . length ;
console . log ( "Number of remaining paragraphs:" , paragraphCount ); // 2
});
C++
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( L "MyClientId" , L "MyClientSecret" );
auto documentName = L "MyPresentation.pptx" ;
auto slideIndex = 1 ;
auto shapeIndex = 1 ;
auto paragraphIndex = 1 ;
auto paragraphsInfo = slidesApi -> deleteParagraph ( documentName , slideIndex , shapeIndex , paragraphIndex ). get ();
auto paragraphCount = paragraphsInfo -> getParagraphLinks (). size ();
std :: cout << "Number of remaining paragraphs: " << paragraphCount ; // 2
}
Perl
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 => 1 , paragraph_index => 2 );
my $paragraphs_info = $slides_api -> delete_paragraph ( %parameters );
my $paragraph_count = @ { $paragraphs_info -> { paragraph_links }};
print ( "Number of remaining paragraphs: " , $paragraph_count ); # 2
Swift
Go
DeleteParagraphs
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs
DELETE
Deletes a range of paragraphs in a shape.
DeleteParagraphs
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The presentation file name.
slideIndex
integer
path
true
The 1-based index of the presentation slide.
shapeIndex
integer
path
true
The 1-based index of the shape.
paragraphs
string
query
false
The indices of paragraphs to be deleted. Delete all by default.
password
string
header
false
The password to open the presentation.
folder
string
query
false
The folder where the presentation file is located.
storage
string
query
false
The storage where the presentation file is located.
subShape
string
query
false
The sub-shape path (e.g. “3”, “3/shapes/2”).
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
In the document MyPresentation.pptx , the sixth slide contains one shape (text box) with five paragraphs. Delete the paragraphs with indices 1 , 3 , and 5 .
cURL Solution
Request
Get an Access Token
curl POST "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=MyClientId&client_secret=MyClientSecret" \
-H "Content-Type: application/x-www-form-urlencoded"
Delete the Paragraphs
curl -X DELETE "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/6/shapes/1/paragraphs?paragraphs=1,3,5" \
-H "authorization: Bearer MyAccessToken"
Response
Response Example
{
"paragraphLinks" : [
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/6/shapes/1/paragraphs/1" ,
"relation" : "self" ,
"slideIndex" : 6 ,
"shapeIndex" : 1
},
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/6/shapes/1/paragraphs/2" ,
"relation" : "self" ,
"slideIndex" : 6 ,
"shapeIndex" : 1
}
],
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/6/shapes/1/paragraphs" ,
"relation" : "self" ,
"slideIndex" : 6 ,
"shapeIndex" : 1
}
}
SDK Solutions
C#
using System ;
using System.Collections.Generic ;
using Aspose.Slides.Cloud.Sdk ;
class Application
{
static void Main ( string [] args )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var documentName = "MyPresentation.pptx" ;
var slideIndex = 6 ;
var shapeIndex = 1 ;
var paragraphIndices = new List < int > { 1 , 3 , 5 };
var paragraphsInfo = slidesApi . DeleteParagraphs ( documentName , slideIndex , shapeIndex , paragraphIndices );
var paragraphCount = paragraphsInfo . ParagraphLinks . Count ;
Console . WriteLine ( "Number of remaining paragraphs: " + paragraphCount ); // 2
}
}
Java
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.Paragraphs ;
import java.util.Arrays ;
import java.util.List ;
import java.lang.Integer ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
String documentName = "MyPresentation.pptx" ;
int slideIndex = 6 ;
int shapeIndex = 1 ;
List < Integer > paragraphIndices = Arrays . asList ( 1 , 3 , 5 );
Paragraphs paragraphsInfo = slidesApi . deleteParagraphs ( documentName , slideIndex , shapeIndex , paragraphIndices , null , null , null , null );
int paragraphCount = paragraphsInfo . getParagraphLinks (). size ();
System . out . println ( "Number of remaining paragraphs: " + paragraphCount ); // 2
}
}
PHP
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 );
$documentName = "MyPresentation.pptx" ;
$slideIndex = 6 ;
$shapeIndex = 1 ;
$paragraphIndices = [ 1 , 3 , 5 ];
$paragraphsInfo = $slidesApi -> deleteParagraphs ( $documentName , $slideIndex , $shapeIndex , $paragraphIndices );
$paragraphCount = count ( $paragraphsInfo -> getParagraphLinks ());
echo "Number of remaining paragraphs: " , $paragraphCount ; // 2
Ruby
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi . new ( configuration )
document_name = "MyPresentation.pptx"
slide_index = 6
shape_index = 1
paragraph_indices = [ 1 , 3 , 5 ]
paragraphs_info = slides_api . delete_paragraphs ( document_name , slide_index , shape_index , paragraph_indices )
paragraph_count = paragraphs_info . paragraph_links . length ()
print "Number of remaining paragraphs: " , paragraph_count # 2
Python
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
document_name = "MyPresentation.pptx"
slide_index = 6
shape_index = 1
paragraph_indices = [ 1 , 3 , 5 ]
paragraphs_info = slides_api . delete_paragraphs ( document_name , slide_index , shape_index , paragraph_indices )
paragraph_count = len ( paragraphs_info . paragraph_links )
print ( "Number of remaining paragraphs:" , paragraph_count ) # 2
Node.js
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
const documentName = "MyPresentation.pptx" ;
const slideIndex = 6 ;
const shapeIndex = 1 ;
const paragraphIndices = [ 1 , 3 , 5 ];
slidesApi . deleteParagraphs ( documentName , slideIndex , shapeIndex , paragraphIndices ). then ( paragraphsInfo => {
const paragraphCount = paragraphsInfo . body . paragraphLinks . length ;
console . log ( "Number of remaining paragraphs:" , paragraphCount ); // 2
});
C++
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( L "MyClientId" , L "MyClientSecret" );
auto documentName = L "MyPresentation.pptx" ;
auto slideIndex = 6 ;
auto shapeIndex = 1 ;
auto paragraphIndices = { 1 , 3 , 5 };
auto paragraphsInfo = slidesApi -> deleteParagraphs ( documentName , slideIndex , shapeIndex , paragraphIndices ). get ();
auto paragraphCount = paragraphsInfo -> getParagraphLinks (). size ();
std :: cout << "Number of remaining paragraphs: " << paragraphCount ; // 2
}
Perl
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 @paragraph_indices = ( 1 , 3 , 5 );
my %parameters = ( name => "MyPresentation.pptx" , slide_index => 6 , shape_index => 1 , paragraphs => \ @paragraph_indices );
my $paragraphs_info = $slides_api -> delete_paragraphs ( %parameters );
my $paragraph_count = @ { $paragraphs_info -> { paragraph_links }};
print ( "Number of remaining paragraphs: " , $paragraph_count ); # 2
Swift
Go
SDKs
Check Available SDKs to learn how to add an SDK to your project.