Question

Endrit Grajcevci on Fri, 28 Oct 2016 12:41:29


Hi,

I am trying to read notes from PowerPoint using C# and I can read them using the following code: 

    Microsoft.Office.Interop.PowerPoint.Application PowerPoint_App = new Microsoft.Office.Interop.PowerPoint.Application();
            Microsoft.Office.Interop.PowerPoint.Presentations multi_presentations = PowerPoint_App.Presentations;
            Microsoft.Office.Interop.PowerPoint.Presentation presentation = multi_presentations.Open(@"C:\Slides.pptx");
            string presentation_text = "";

                foreach (var item in presentation.Slides[12].Shapes)
                {
                    var shape = (PowerPoint.Shape)item;
                    if (shape.HasTextFrame == MsoTriState.msoTrue)
                    {
                        if (shape.TextFrame.HasText == MsoTriState.msoTrue)
                        {
                            var textRange = shape.TextFrame.TextRange;
                            var text = textRange.Text;
                            presentation_text += text + " ";
                        }
                    }
                }
            PowerPoint_App.Quit();
            Console.WriteLine(presentation_text);

but the problem is that I am getting text from notes line by line without style.

Is it possible to read PowerPoint notes including the style (ex if the text is bold to get a html tag like this <b>text</b>)?

Thank you in advance.


Sponsored



Replies

Celeste Li on Mon, 31 Oct 2016 01:55:01


Hi,

It is impossible to read text with style shown as HTML tags.

HTML tags are only used in Outlook HTMLbody.

Regards,

Celeste