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

SaveHtmlTopic() private static method

Saves one section of a document as an HTML file. Any embedded images are saved as separate files in the same folder as the HTML file.
private static SaveHtmlTopic ( Section section, Topic topic ) : void
section Section
topic Topic
return void
        private static void SaveHtmlTopic(Section section, Topic topic)
        {
            Document dummyDoc = new Document();
            dummyDoc.RemoveAllChildren();
            dummyDoc.AppendChild(dummyDoc.ImportNode(section, true, ImportFormatMode.KeepSourceFormatting));

            dummyDoc.BuiltInDocumentProperties.Title = topic.Title;

            HtmlSaveOptions saveOptions = new HtmlSaveOptions();
            saveOptions.PrettyFormat = true;
            // This is to allow headings to appear to the left of main text.
            saveOptions.AllowNegativeIndent = true;
            saveOptions.ExportHeadersFootersMode = ExportHeadersFootersMode.None;

            dummyDoc.Save(topic.FileName, saveOptions);
        }