Read Text Items Introduction
Aspose.Slides Cloud lets you easily read all text items from a PowerPoint presentation. This article shows REST methods for reading text items both from a single slide and from an entire presentation at once. You can specify whether empty items should also be considered. The methods below take into account any presentation object containing a text frame.
GetPresentationTextItems
API
Type
Description
Resource
/slides/{name}/textItems
GET
Reads text items from a PowerPoint presentation.
GetPresentationTextItems
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The name of a presentation file.
withEmpty
boolean
query
false
Indicates whether empty text items should be considered. The default value is false
.
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
Get all text items, including empty ones, from MyFolder/MyPresentation.pptx document saved to the default storage.
cURL Solution
Request
Get an Access Token
Copy curl -X 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"
Get Text Items
Copy curl -X GET "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/textItems?withEmpty=true&folder=MyFolder" \
-H "authorization: Bearer <access_token>"
Response
Response Example
Copy {
"items" : [
{
"uri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/shapes/1?folder=MyFolder" ,
"relation" : "parent" ,
"slideIndex" : 1
},
"text" : "This is a text box on slide 1."
},
{
"uri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/shapes/1?folder=MyFolder" ,
"relation" : "parent" ,
"slideIndex" : 2
},
"text" : "This is a circle on slide 2."
},
{
"uri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/shapes/2?folder=MyFolder" ,
"relation" : "parent" ,
"slideIndex" : 2
},
"text" : ""
},
{
"uri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/shapes/3?folder=MyFolder" ,
"relation" : "parent" ,
"slideIndex" : 2
},
"text" : "This is a WordArt on slide 2."
}
],
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/textItems?folder=MyFolder" ,
"relation" : "self"
}
}
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System.Diagnostics ;
class Application
{
static void Main ( )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var textItems = slidesApi . GetPresentationTextItems ( "MyPresentation.pptx" , true , null , "MyFolder" );
foreach ( var textItem in textItems . Items )
{
Debug . WriteLine ( textItem . Text );
}
}
}
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" );
TextItems textItems = slidesApi . getPresentationTextItems ( "MyPresentation.pptx" , true , null , "MyFolder" , null );
for ( TextItem textItem : textItems . getItems ()) {
System . out . println ( textItem . getText ());
}
}
}
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 );
$textItems = $slidesApi -> getPresentationTextItems ( "MyPresentation.pptx" , TRUE , null , "MyFolder" );
foreach ( $textItems -> getItems () as $textItem ) {
echo $textItem -> getText (), " \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 )
text_items = slides_api . get_presentation_text_items ( "MyPresentation.pptx" , true , nil , "MyFolder" )
for text_item in text_items . items
puts text_item . text
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
text_items = slides_api . get_presentation_text_items ( "MyPresentation.pptx" , True , None , "MyFolder" )
for text_item in text_items . items :
print ( text_item . text )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
slidesApi . getPresentationTextItems ( "MyPresentation.pptx" , true , null , "MyFolder" ). then ( textItems => {
textItems . body . items . forEach ( textItem => {
console . log ( textItem . text );
});
});
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "MyClientId" , L "MyClientSecret" );
auto textItems = slidesApi -> getPresentationTextItems ( L "MyPresentation.pptx" , true , L "" , L "MyFolder" ). get ();
for ( auto textItem : textItems -> getItems ()) {
std :: wcout << textItem -> getText () << std :: endl ;
}
std :: cin . get ();
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" , with_empty => true , folder => "MyFolder" );
my $text_items = $slides_api -> get_presentation_text_items ( %parameters );
for my $text_item ( @ { $text_items -> { items }}) {
print $text_item -> { text }, "\n" ;
}
Swift
Go
Copy
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
var withEmpty bool = true
textItems , _ , e := api . SlidesApi . GetPresentationTextItems ( "MyPresentation.pptx" , & withEmpty , "" , "MyFolder" , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "Found %v items." , len ( textItems . GetItems ()))
GetSlideTextItems
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/textItems
GET
Reads text items from a presentation slide.
GetSlideTextItems
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 read text items.
withEmpty
boolean
query
false
Indicates whether empty text items should be considered. The default value is false
.
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
Get all text items from the second slide of MyFolder/MyPresentation.pptx document saved to the default storage. Ignore empty items.
cURL Solution
Request
Get an Access Token
Copy curl -X 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"
Get Text Items
Copy curl -X GET "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/textItems?folder=MyFolder" \
-H "authorization: Bearer <access_token>"
Response
Response Example
Copy {
"items" : [
{
"uri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/shapes/1?folder=MyFolder" ,
"relation" : "parent" ,
"slideIndex" : 2
},
"text" : "This is a circle on slide 2."
},
{
"uri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/shapes/3?folder=MyFolder" ,
"relation" : "parent" ,
"slideIndex" : 2
},
"text" : "This is a WordArt on slide 2."
}
],
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/2/textItems?folder=MyFolder" ,
"relation" : "self" ,
"slideIndex" : 2
}
}
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System.Diagnostics ;
class Application
{
static void Main ( )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var textItems = slidesApi . GetSlideTextItems ( "MyPresentation.pptx" , 2 , null , null , "MyFolder" );
foreach ( var textItem in textItems . Items )
{
Debug . WriteLine ( textItem . Text );
}
}
}
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" );
TextItems textItems = slidesApi . getSlideTextItems ( "MyPresentation.pptx" , 2 , null , null , "MyFolder" , null );
for ( TextItem textItem : textItems . getItems ()) {
System . out . println ( textItem . getText ());
}
}
}
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 );
$textItems = $slidesApi -> getSlideTextItems ( "MyPresentation.pptx" , 2 , null , null , "MyFolder" );
foreach ( $textItems -> getItems () as $textItem ) {
echo $textItem -> getText (), " \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 )
text_items = slides_api . get_slide_text_items ( "MyPresentation.pptx" , 2 , nil , nil , "MyFolder" )
for text_item in text_items . items
puts text_item . text
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
text_items = slides_api . get_slide_text_items ( "MyPresentation.pptx" , 2 , None , None , "MyFolder" )
for text_item in text_items . items :
print ( text_item . text )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
slidesApi . getSlideTextItems ( "MyPresentation.pptx" , 2 , null , null , "MyFolder" ). then ( textItems => {
textItems . body . items . forEach ( textItem => {
console . log ( textItem . text );
});
});
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "MyClientId" , L "MyClientSecret" );
auto textItems = slidesApi -> getSlideTextItems ( L "MyPresentation.pptx" , 2 , NULL , L "" , L "MyFolder" ). get ();
for ( auto textItem : textItems -> getItems ()) {
std :: wcout << textItem -> getText () << std :: endl ;
}
std :: cin . get ();
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 => 2 , folder => "MyFolder" );
my $text_items = $slides_api -> get_slide_text_items ( %parameters );
for my $text_item ( @ { $text_items -> { items }}) {
print $text_item -> { text }, "\n" ;
}
Swift
Go
Copy
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
textItems , _ , e := api . SlidesApi . GetSlideTextItems ( "MyPresentation.pptx" , 1 , nil , "" , "MyFolder" , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "Found %v items." , len ( textItems . GetItems ()))
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.