Free Support Forum - aspose.com

Set Title of the First Slide

Hello,

I build a presentation from several ppt files and a pot Template file. To do this, I use this code :

Presentation outputPres = new Presentation("myTemplate.pot");

Then I do a loop to add each wanted slide from each presentation

sourcePres.CloneSlide(sourcePres.GetSlideByPosition(slideId), outputPres.Slides.LastSlidePosition + 1, outputPres, temp);

Then I save this new Presentation to a PPT File.Until now all is OK.

But now I want to edit the "title text" of my "title slide" (the first slide)...Have I to edit the Master Template ? Slide ? Can you explain me how to do this ? (Find the title text and edit it)

Thanks a lot !

You can change title text before saving a presentation or open saved presentation again and change title after that.

Title of a slide is a text of title placeholder.
How to change text you can find in the Programmer’s Guide.
For example in the Replacing text on the Placeholder article.
Also our demos have several code examples for that.

Thanks for your speedy answer Smile [:)]

Of course...the asked code take place before save code.

I have already read the Replacing Text article...but there is no TextHolder in my PlaceHolders (I catch a Cast Exception each iteration of my loop).Sad [:(]

Does the Title Place defined by the .POT Template accessible by a classic PlaceHolder in the Title Slide ?

Thanks a lot for your answer

EDIT : I found 2 PlaceHolders, with following types : CenteredTitle2 and SubTitle...But How can i edit them if I can't cast them to TextHolder ?

If slide doesn’t have TextHolder you can’t change title text but you can add rectangle
with text in any position of a slide. Please check this chapter.
After that you can add TextFrame to this rectangle and insert some text.