Click or drag to resize

HtmlFlowingSaveOptions Class

Represents options for saving to flowing HyperText Markup Language (HTML) format.
Inheritance Hierarchy

Namespace:  SautinSoft.Document
Assembly:  SautinSoft.Document (in SautinSoft.Document.dll) Version: 3.7.4.3 (3.7.4.3)
Syntax
public sealed class HtmlFlowingSaveOptions : HtmlSaveOptions

The HtmlFlowingSaveOptions type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleHtmlFlowingSaveOptions
Initializes a new instance of the HtmlFlowingSaveOptions class.
Top
Properties
  NameDescription
Public propertyBuildNavigationPage
Whether to generate a navigation page (like a TOC - table of contents) or not. Default value: true.
Public propertyContentType
Gets the content-type for HTML file format.
(Inherited from HtmlSaveOptions.)
Public propertyCode exampleCssExportMode
Specifies how CSS (Cascading Style Sheet) styles are exported to HTML or MHTML. Default value is Inline.
(Inherited from HtmlSaveOptions.)
Public propertyCssFileName
Specifies the path and the name of the Cascading Style Sheet (CSS) file written when a document is exported to HTML. Default is an empty string.
(Inherited from HtmlSaveOptions.)
Public propertyCssStream
Allows to specify the stream where the CSS information will be saved to.
(Inherited from HtmlSaveOptions.)
Public propertyEmbedImages
Gets or sets a value indicating whether images are embedded directly within the HTML file in form of Base64 encoding.
(Inherited from HtmlSaveOptions.)
Public propertyEncoding
Gets or sets the encoding for the HTML file.
(Inherited from HtmlSaveOptions.)
Public propertyHeadersFootersExportMode
Specifies how headers and footers are output to HTML and MHTML. Default value is PerSection.
Public propertyImageSavingCallback
Allows to control how images are saved when a document is saved to HTML.
(Inherited from HtmlSaveOptions.)
Public propertyImagesDirectoryPath
Gets or sets the physical directory where all images will be saved.
(Inherited from HtmlSaveOptions.)
Public propertyImagesDirectorySrcPath
Gets or sets the relative directory that will be used when referencing images in the HTML.
(Inherited from HtmlSaveOptions.)
Public propertyKeepCssStreamOpen
Specifies whether keep the stream open or close it after saving an CSS information.
(Inherited from HtmlSaveOptions.)
Public propertyCode exampleListExportMode
Controls how list labels are output to HTML or MHTML. Default value is Auto.
Public propertyPartSavingCallback
Allows to control how document parts are saved when a document is saved to HTML.
Public propertyProduceOnlyHtmlBody
Gets or sets a value to produce a complete HTML document or only between between <body>...</body> tags. Default value: false.
(Inherited from HtmlSaveOptions.)
Public propertySplitCriteria
Specifies how the document should be split when saving to Html format. Default is None.
Public propertySplitHeadingLevel
Specifies the maximum level of headings at which to split the document. Default value is 2.
Public propertyTitle
Gets and sets a title for the produced HTML document. Default value: "Untitled document".
(Inherited from HtmlSaveOptions.)
Public propertyUseNumericCharacterReference
In case of 'true': Write the all characters in "NCR" notation: &#xxx;. In case of 'false': Write the all characters as Unicode (recommended). Default value: false.
(Inherited from HtmlSaveOptions.)
Public propertyCode exampleVersion
Specifies version of HTML standard that should be used when saving the document to HTML or MHTML. Default value is Xhtml.
(Inherited from HtmlSaveOptions.)
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
Save document as HTML (in the Fixed and Flowing modes) using C#
using System.IO;
using SautinSoft.Document;

namespace Example
{
    class Program 
    {        
        static void Main(string[] args)
        {
            SaveToHtmlFile();
            SaveToHtmlStream();
        }

        /// <summary>
        /// Open an existing document and saves it as HTML files (in the Fixed and Flowing modes).
        /// </summary>
        /// <remarks>
        /// Details: https://www.sautinsoft.com/products/document/examples/save-document-as-html-net-csharp-vb.php
        /// </remarks>
        static void SaveToHtmlFile()
        {
            string inputFile = @"..\..\example.docx";

            DocumentCore dc = DocumentCore.Load(inputFile);           

            string fileHtmlFixed = @"Fixed-as-file.html";
            string fileHtmlFlowing = @"Flowing-as-file.html";

            // Save to HTML file: HtmlFixed.
            dc.Save(fileHtmlFixed, new HtmlFixedSaveOptions()
            {
                Version = HtmlVersion.Html5,
                CssExportMode = CssExportMode.Inline
            });

            // Save to HTML file: HtmlFlowing.
            dc.Save(fileHtmlFlowing, new HtmlFlowingSaveOptions()
            {
                Version = HtmlVersion.Html5,
                CssExportMode = CssExportMode.Inline,
                ListExportMode = HtmlListExportMode.ByHtmlTags
            });

            // Open the results for demonstation purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(fileHtmlFixed) { UseShellExecute = true });
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(fileHtmlFlowing) { UseShellExecute = true });

        }

        /// <summary>
        /// Creates a new document and saves it as HTML documents (in the Fixed and Flowing modes) using MemoryStream.
        /// </summary>
        /// <remarks>
        /// Details: https://www.sautinsoft.com/products/document/examples/save-document-as-html-net-csharp-vb.php
        /// </remarks>
        static void SaveToHtmlStream()
        {
            // There variables are necessary only for demonstration purposes.
            byte[] fileData = null;
            string fileHtmlFixed = @"Fixed-as-stream.html";
            string fileHtmlFlowing = @"Flowing-as-stream.html";

            // Assume we already have a document 'dc'.
            DocumentCore dc = new DocumentCore();
            dc.Content.End.Insert("Hey Guys and Girls!");

            // Let's save our document to a MemoryStream.
            using (MemoryStream ms = new MemoryStream())
            {
                // HTML Fixed.
                dc.Save(ms, new HtmlFixedSaveOptions());
                fileData = ms.ToArray();

                File.WriteAllBytes(fileHtmlFixed, fileData);

                // Or HTML flowing.
                dc.Save(ms, new HtmlFlowingSaveOptions());
                fileData = ms.ToArray();

                File.WriteAllBytes(fileHtmlFlowing, fileData);
            }
        }
    }
}
Save document as HTML (in the Fixed and Flowing modes) using VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document

Module Sample
    Sub Main()
        SaveToHtmlFile()
        SaveToHtmlStream()
    End Sub

    ''' <summary>
    ''' Open an existing document and saves it as HTML files (in the Fixed and Flowing modes).
    ''' </summary>
    ''' <remarks>
    ''' Details: https://www.sautinsoft.com/products/document/examples/save-document-as-html-net-csharp-vb.php
    ''' </remarks>
    Sub SaveToHtmlFile()
        Dim inputFile As String = "..\example.docx"

        Dim dc As DocumentCore = DocumentCore.Load(inputFile)

        Dim fileHtmlFixed As String = "Fixed-as-file.html"
        Dim fileHtmlFlowing As String = "Flowing-as-file.html"

        ' Save to HTML file: HtmlFixed.
        dc.Save(fileHtmlFixed, New HtmlFixedSaveOptions() With {
            .Version = HtmlVersion.Html5,
            .CssExportMode = CssExportMode.Inline
        })

        ' Save to HTML file: HtmlFlowing.
        dc.Save(fileHtmlFlowing, New HtmlFlowingSaveOptions() With {
            .Version = HtmlVersion.Html5,
            .CssExportMode = CssExportMode.Inline,
            .ListExportMode = HtmlListExportMode.ByHtmlTags
        })

        ' Open the results for demonstation purposes.
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(fileHtmlFixed) With {.UseShellExecute = True})
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(fileHtmlFlowing) With {.UseShellExecute = True})

    End Sub

    ''' <summary>
    ''' Creates a new document and saves it as HTML documents (in the Fixed and Flowing modes) using MemoryStream.
    ''' </summary>
    ''' <remarks>
    ''' Details: https://www.sautinsoft.com/products/document/examples/save-document-as-html-net-csharp-vb.php
    ''' </remarks>
    Sub SaveToHtmlStream()
        ' There variables are necessary only for demonstration purposes.
        Dim fileData() As Byte = Nothing
        Dim fileHtmlFixed As String = "Fixed-as-stream.html"
        Dim fileHtmlFlowing As String = "Flowing-as-stream.html"

        ' Assume we already have a document 'dc'.
        Dim dc As New DocumentCore()
        dc.Content.End.Insert("Hey Guys and Girls!")

        ' Let's save our document to a MemoryStream.
        Using ms As New MemoryStream()
            ' HTML Fixed.
            dc.Save(ms, New HtmlFixedSaveOptions())
            fileData = ms.ToArray()

            File.WriteAllBytes(fileHtmlFixed, fileData)

            ' Or HTML flowing.
            dc.Save(ms, New HtmlFlowingSaveOptions())
            fileData = ms.ToArray()

            File.WriteAllBytes(fileHtmlFlowing, fileData)
        End Using
    End Sub
End Module
See Also