How to get all SmartArt from a slide? RRS feed

  • Question

  • Hi,

    I have to find all the information of a smart art. 

    SmartArt type,SmartArt Name and the text in it

    from the above image I want to find the below information

    type: Hierarchy.

    name: Organizational chart.

    text: Madan4.

    with or with out using interop

    Till now by using OpenXML I can able to get only the text of a smart art.

    var diagramDataPartsList = slidePart.DiagramDataParts;
    if (diagramDataPartsList.Count() > 0)
    foreach (var diagramDataParts in diagramDataPartsList)
    var text = diagramDataParts.DataModelRoot.PointList.InnerText;
    if (!string.IsNullOrEmpty(text))
    //new CopySlide().copySlides(slidePart, @"D:\Projects\Task\Documents\BlankCopy - Copy.pptx");


    Tuesday, November 3, 2015 10:09 AM


  • Hi Madan,

    For this requirement, you could achieve that through PowerPoint object model.

    >> type: Hierarchy.

    SmartArt. Layout.Category

    >> name: Organizational chart.

     SmartArt. Layout.Name

    >> text: Madan4.


    Sample code:

    Sub SmartTest()
    Dim s As Shape
    Dim sr As SmartArt
    Dim srn As SmartArtNode
    Set s = ActivePresentation.Slides(1).Shapes(3)
    Set sr = s.SmartArt
    MsgBox sr.Layout.Category
    MsgBox sr.Layout.Name
    For Each srn In sr.AllNodes
     MsgBox srn.TextFrame2.TextRange.Text
    End Sub



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Madan Mishra Wednesday, November 4, 2015 10:13 AM
    Wednesday, November 4, 2015 9:20 AM