Hi,
This is my code :

Microsoft.Office.Interop.PowerPoint.Application application = new Microsoft.Office.Interop.PowerPoint.Application();
                string filePath = Server.MapPath(@"~\\Staf\\TestDoc\\" + strFileName.ToString());
                Microsoft.Office.Interop.PowerPoint.Presentation pptPresentation = application.Presentations.Open(filePath, 
                    Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, 
                    Microsoft.Office.Core.MsoTriState.msoFalse);
                application.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;

                StringBuilder sb = new StringBuilder();
                int page = pptPresentation.Slides.Count;
                for (int num = 1; num < page + 1; num++)
                {
                    Microsoft.Office.Interop.PowerPoint.Shapes slide = pptPresentation.Slides[num].Shapes;
                    //loop through all the shapes
                    foreach (Microsoft.Office.Interop.PowerPoint.Shape s in slide)
                    {
                        // Check to see if shape has a text frame and text
                        if (s.HasTextFrame == MsoTriState.msoTrue && s.TextFrame.HasText == MsoTriState.msoTrue)
                        {
                            if (s.Type.Equals(MsoShapeType.msoPlaceholder))
                            {
                                switch (s.PlaceholderFormat.Type)
                                {
                                    case PpPlaceholderType.ppPlaceholderTitle:
                                        sb.Append(s.TextFrame.TextRange.Text);
                                        sb.Append(Environment.NewLine);
                                        break;
                                    case PpPlaceholderType.ppPlaceholderCenterTitle:
                                        sb.Append(s.TextFrame.TextRange.Text);
                                        sb.Append(Environment.NewLine);
                                        break;
                                    case PpPlaceholderType.ppPlaceholderBody:
                                        sb.Append(s.TextFrame.TextRange.Text);
                                        sb.Append(Environment.NewLine);
                                        break;
                                    case PpPlaceholderType.ppPlaceholderSubtitle:
                                        sb.Append(s.TextFrame.TextRange.Text);
                                        sb.Append(Environment.NewLine);
                                        break;
                                    case PpPlaceholderType.ppPlaceholderFooter:
                                        sb.Append(s.TextFrame.TextRange.Text);
                                        sb.Append(Environment.NewLine);
                                        break;
                                    case PpPlaceholderType.ppPlaceholderHeader:
                                        sb.Append(s.TextFrame.TextRange.Text);
                                        sb.Append(Environment.NewLine);
                                        break;
                                    default:
                                        // don't need anything else
                                        break;
                                }
                            }
                        }
                    }
                }
                string text = sb.ToString();

                 // Close word.
                pptPresentation.Close();
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pptPresentation);
                //wordApp.Application.Quit();

with my code, i can't read content of slide 2, 3, etc..
its just read slide 1 and all title of the ppt file. Whats wrong? What should i do?

thx,

Thank you for posting code...
i see that you used a switch statement that will process the flow "default" if the type placeholderformat is out of control...and this causes the problem because when the type is ppPlaceholderObject as an example;it wont add the the texframe range text to stringbuilder.i suggest you to remove switch control and use your code.let me know if helped...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.