How to read the title of each slide

Powerpoint automation had the property shapes.Title.TextFrame.TextRange.Text to get the title for each slide.

I am trying to do the same with Aspose but I haven’t found a way. I searched the forums and I came up with this old post Adding a Header Slide and Title not being displayed but still doesn’t seem to work for this version.

Could anybody help me with this?

Thanks.


Hi,


I have observed the requirements shared by you. Actually, you need to traverse through every slide shape and find the placeholder with type Title. Then you need to access its text frame and extract the desired text. Please try using the following sample code on your end to serve the purpose. Please share, if I may help you further in this regard.

public static void testPlaceholder()
{
String path = @“C:\Presentations”;
Presentation pres = new Presentation(path + “Test.pptx”);
foreach (ISlide slide in pres.Slides)
{
foreach (IShape shape in slide.Shapes)
{
if (shape.Placeholder != null)
{
IPlaceholder placeholder = shape.Placeholder;
if (placeholder.Type == PlaceholderType.Title)
{
ITextFrame textFrm = ((IAutoShape)shape).TextFrame;
String text = textFrm.Text;
}
}
}

}
}

Many Thanks,

Thanks, Mudassir. It works great.