Aspose.Slides.Examples.CSharp.Text.ExportingHTMLText.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();


            // Load the presentation file
            using (Presentation pres = new Presentation(dataDir + "ExportingHTMLText.pptx"))
            {

                // Acesss the default first slide of presentation
                ISlide slide = pres.Slides[0];

                // Desired index
                int index = 0;

                // Accessing the added shape
                IAutoShape ashape = (IAutoShape)slide.Shapes[index];

                // Extracting first paragraph as HTML
                StreamWriter sw = new StreamWriter(dataDir + "output_out.html", false, Encoding.UTF8);

                //Writing Paragraphs data to HTML by providing paragraph starting index, total paragraphs to be copied
                sw.Write(ashape.TextFrame.Paragraphs.ExportToHtml(0, ashape.TextFrame.Paragraphs.Count, null));

                sw.Close();
            }

            
        }
    }
ExportingHTMLText