We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to find the title of a slide?

I want to use the presentation component to create a table of content of all slides in the presentation. Up to now I have used a poerpoint macro for this where I retrieve the title of the slide (as entered under powerpoint in the title box). Here is a snippet of the VBA macro:

On Error Resume Next  ' in case there's no title placeholder on the slide
For Each oSlide In ActiveWindow.Presentation.Slides
    strTitles = strTitles _
        & "#####." _
        & CStr(oSlide.SlideIndex) _
        & "  - " & oSlide.Shapes.Title.TextFrame.TextRange.Text _
        & vbCrLf
Next oSlide

As you can see in VBA the shape has a title attribute which holds the slide title.
Although IShape has a title attribute it seldom has the slide title. It is 99% empty. I have see that in powerpoint 2016 the title shape name starts with "Title" but this is not the case in older version (and the VBA code works ok for older versions). Long story for the question: how to retrieve the slide title (what ppt called the title from the title textbox/shape).

I have added a test pptm file with the complete macro

BTW: the component rejects .PPTM files (which is just a PPTX with VBA macros in it). Maybe in the next release.
Would also love to have to the recorded audio of the slide (to be able to detach it).


Attachment: ppt_titles_9dd150f7.zip

3 Replies

AP Arun Prasad Matheshwaran Syncfusion Team October 24, 2016 11:59 AM UTC

Hi Klaas Brant, 
Thanks for your update. 
Query 
Response 

I want to use the presentation component to create a table of content of all slides in the presentation. Up to now I have used a PowerPoint macro for this where I retrieve the title of the slide (as entered under PowerPoint in the title box). Here is a snippet of the VBA macro:  

  

On Error Resume Next  ' in case there's no title placeholder on the slide 

For Each oSlide In ActiveWindow.Presentation.Slides 

    strTitles = strTitles _ 

        & "#." _ 

        & CStr(oSlide.SlideIndex) _ 

        & "  - " & oSlide.Shapes.Title.TextFrame.TextRange.Text _ 

        & vbCrLf 

Next oSlide 

  

As you can see in VBA the shape has a title attribute which holds the slide title. 

Although IShape has a title attribute it seldom has the slide title. It is 99% empty. I have see that in PowerPoint 2016 the title shape name starts with "Title" but this is not the case in older version (and the VBA code works ok for older versions). Long story for the question: how to retrieve the slide title (what ppt called the title from the title textbox/shape). 

  

I have added a test pptm file with the complete macro 

We have created a simple Windows Form sample to create table of contents of all slides in a presentation by using the "Title Placeholder". Please follow the below sample attached and let us know whether it could satisfy your requirement. 

Sample: 

 http://www.syncfusion.com/downloads/support/forum/127024/ze/TableOfContents1672454064 

 

BTW: the component rejects .PPTM files (which is just a PPTX with VBA macros in it). Maybe in the next release.  

We could see that you have created a separate incident for these queries, please follow up with those incidents for further updates. 

Would also love to have to the recorded audio of the slide (to be able to detach it). 


Please let us know if you need any further clarifications regarding this, 

Regards, 
Arun 



KB Klaas Brant October 24, 2016 12:26 PM UTC

Works like a charm. Thanks for the sample! Really helpful.

Greetings,
KB


DJ Devisri Jothi Syncfusion Team October 25, 2016 04:14 AM UTC

Hi Klaas, 
We are glad that the provided sample was helpful, please let us know if you need any further assistance. 
Thanks, 
Devisri 


Loader.
Up arrow icon