Working with SmartArt Text Introduction
You can manage text within a SmartArt node the same way as it works for child shapes in group shapes. Instead of the path to a child shape, the path to a child node must be specified. The child node path is a string that contains a node index (e.g. “1”) or a path in case of more than one level of grouping ( e.g. “1/nodes/1”).
To manage text within a SmartArt node, use the methods described in Working with Paragraphs and Working with Text Portions .
cURL Example
The code example below shows how to update a text portion in an existing SmartArt object.
SDK Source
The Aspose for Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
C#
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
Portion portion = new Portion ()
{
Text = "New text" ,
FontHeight = 24 ,
FontBold = Portion . FontBoldEnum . True ,
Spacing = 3 ,
FillFormat = new SolidFill () { Color = "#FFFFFF00" }
};
string subNodePath = "1/nodes/2" ;
int slideIndex = 7 ;
int nodeIndex = 1 ;
int paragraphIndex = 1 ;
int portionIndex = 1 ;
Portion response = api . UpdatePortion ( "MyPresentation.pptx" , slideIndex , nodeIndex , paragraphIndex , portionIndex , portion , subShape : subNodePath );
Console . WriteLine ( $"The portion with text \" { response . Text } \ " has been updated" );
Java
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
Portion portion = new Portion ();
portion . setText ( "New text" );
portion . setFontHeight ( 24 . 0 );
portion . setFontBold ( Portion . FontBoldEnum . TRUE );
portion . spacing ( 3 . 0 );
SolidFill fillFormat = new SolidFill ();
fillFormat . setColor ( "#FFFFFF00" );
portion . setFillFormat ( fillFormat );
String subNodePath = "1/nodes/2" ;
int slideIndex = 7 ;
int nodeIndex = 1 ;
int paragraphIndex = 1 ;
int portionIndex = 1 ;
Portion response = api . updatePortion ( "MyPresentation.pptx" , slideIndex , 1 , 1 , 1 , portion , null , null , null , subNodePath );
System . out . println ( "The portion with text \"" + response . getText () + "\" has been updated" );
PHP
use Aspose\Slides\Cloud\Sdk\Api\Configuration ;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi ;
use Aspose\Slides\Cloud\Sdk\Model\Portion ;
use Aspose\Slides\Cloud\Sdk\Model\SolidFill ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "MyClientId" );
$configuration -> setAppKey ( "MyClientSecret" );
$api = new SlidesApi ( null , $configuration );
$portion = new Portion ();
$portion -> setText ( "New text" );
$portion -> setFontHeight ( 24 );
$portion -> setFontBold ( "True" );
$portion -> setSpacing ( 3 );
$fillFormat = new SolidFill ();
$fillFormat -> setColor ( "#FFFFFF00" );
$portion -> setFillFormat ( $fillFormat );
$subNodePath = "1/nodes/2" ;
$slideIndex = 7 ;
$response = $api -> updatePortion ( "MyPresentation.pptx" , $slideIndex , 1 , 1 , 1 , $portion , null , null , null , $subNodePath );
print ( "The portion with text \" " . $response -> getText () . " \" has been updated" );
Ruby
configuration = AsposeSlidesCloud :: Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
api = AsposeSlidesCloud :: SlidesApi . new ( configuration )
#Code example will be added soon.
Python
import asposeslidescloud
from asposeslidescloud.configuration import Configuration
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.portion import Portion
from asposeslidescloud.models.solid_fill import SolidFill
configuration = Configuration ()
configuration . app_sid = 'MyClientId'
configuration . app_key = 'MyClientSecret'
api = SlidesApi ( configuration )
portion = Portion ()
portion . text = "New text"
portion . font_height = 24
portion . font_bold = "True"
portion . spacing = 3
fill_format = SolidFill ()
fill_format . color = "#FFFFFF00"
portion . fill_format = fill_format
sub_node = "1/nodes/2"
slide_index = 7
response = api . update_portion ( "MyPresentation.pptx" , slide_index , 1 , 1 , 1 , portion , None , None , None , sub_node )
print ( "The portion with text \" " + response . text + " \" has been updated" )
Node.js
const CloudSdk = require ( "asposeslidescloud" );
const api = new CloudSdk . SlidesApi ( "MyClientId" , "MyClientSecret" );
const portion = new CloudSdk . Portion ();
portion . text = "New text" ;
portion . fontHeight = 24 ;
portion . fontBold = CloudSdk . Portion . FontBoldEnum . True ;
portion . spacing = 3 ;
const fillFormat = new CloudSdk . SolidFill ();
fillFormat . color = "#FFFFFF00" ;
portion . fillFormat = fillFormat ;
const subNodePath = "1/nodes/2" ;
const slideIndex = 7 ;
const response = await api . updatePortion ( "MyPresentation.pptx" , slideIndex , 1 , 1 , 1 , portion , null , null , null , subNodePath );
console . log ( "The portion with text \"" + response . body . text + "\" has been updated" );
Go
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
portion := asposeslidescloud . NewPortion ()
portion . Text = "New text"
portion . FontHeight = 24
portion . FontBold = "True"
portion . Spacing = 3
fillFormat := asposeslidescloud . NewSolidFill ()
fillFormat . Color = "#FFFFFF00"
portion . FillFormat = fillFormat
subNodePath := "1/nodes/2"
var slideIndex int32 = 7
response , _ , e := api . SlidesApi . UpdatePortion ( "MyPresentation.pptx" , slideIndex , 1 , 1 , 1 , portion , "" , "" , "" , subNodePath )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "The portion with text \"%v\" has been updated" , response . GetText ())
C++
Perl
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
#Code example will be added soon.
Swift