Aspose.Words.Examples.CSharp.Loading_Saving.Worker.SaveHtmlTopics C# (CSharp) Method

SaveHtmlTopics() private method

Splits the current document into one topic per section and saves each topic As an HTML file. Returns a collection of Topic objects.
private SaveHtmlTopics ( ) : ArrayList
return System.Collections.ArrayList
        private ArrayList SaveHtmlTopics()
        {
            ArrayList topics = new ArrayList();
            for (int sectionIdx = 0; sectionIdx < mDoc.Sections.Count; sectionIdx++)
            {
                Section section = mDoc.Sections[sectionIdx];

                string paraText = section.Body.FirstParagraph.GetText();

                // The text of the heading paragaph is used to generate the HTML file name.
                string fileName = MakeTopicFileName(paraText);
                if (fileName == "")
                    fileName = "UNTITLED SECTION " + sectionIdx;

                fileName = Path.Combine(mDstDir, fileName + ".html");

                // The text of the heading paragraph is also used to generate the title for the TOC.
                string title = MakeTopicTitle(paraText);
                if (title == "")
                    title = "UNTITLED SECTION " + sectionIdx;

                Topic topic = new Topic(title, fileName);
                topics.Add(topic);

                SaveHtmlTopic(section, topic);
            }

            return topics;
        }