none
How to find description of multiple tables in a single powerpoint file RRS feed

  • Question

  • How to find description of multiple tables in a single powerpoint file using open xml library
    Tuesday, August 9, 2016 11:05 AM

Answers

  • >>How to find description of multiple tables in a single powerpoint file using open xml library

    To retrieve description of multiple tables in a single powerpoint file, please see the code below.

    using System;
    using DocumentFormat.OpenXml.Presentation;
    using DocumentFormat.OpenXml.Packaging;
    using A = DocumentFormat.OpenXml.Drawing;
    
                string docName = (@"C:\Users\Administrator\Desktop\Presentation1.pptx");
               
     using (PresentationDocument doc = PresentationDocument.Open(docName, true))
                {
                    PresentationPart pptPart = doc.PresentationPart;
    
                    foreach (SlidePart slPart in pptPart.SlideParts)
                    {
                        Slide slide1 = slPart.Slide;
                        CommonSlideData commonSlideData1 = slide1.GetFirstChild<CommonSlideData>();
                        DocumentFormat.OpenXml.Presentation.ShapeTree shapeTree1 = commonSlideData1.GetFirstChild<DocumentFormat.OpenXml.Presentation.ShapeTree>();
                        foreach (GraphicFrame graphicFrame1 in shapeTree1.Elements<GraphicFrame>())
                        {
                            NonVisualGraphicFrameProperties nonVisualGraphicFrameProperties1 = graphicFrame1.NonVisualGraphicFrameProperties;
                            DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties nonVisualDrawingProperties1 = nonVisualGraphicFrameProperties1.NonVisualDrawingProperties;
                            var tableName = nonVisualDrawingProperties1.Name;
                            var description = nonVisualDrawingProperties1.Description;
                            Console.WriteLine("The description of "+ tableName
                                + " is: "+ description);                   
                        }
                    }
                }
                Console.ReadKey();
    


    Wednesday, August 10, 2016 5:23 AM
    Moderator