Click or drag to resize

RtfToHtmlHtmlFixedSaveOptions Class

Represents options for saving to fixed HyperText Markup Language (HTML) format.
Inheritance Hierarchy
SystemObject
  SautinSoftRtfToHtmlHtmlSaveOptions
    SautinSoftRtfToHtmlHtmlFixedSaveOptions

Namespace: SautinSoft
Assembly: SautinSoft.RtfToHtml (in SautinSoft.RtfToHtml.dll) Version: 2023.10.18
Syntax
public sealed class HtmlFixedSaveOptions : RtfToHtmlHtmlSaveOptions

The RtfToHtmlHtmlFixedSaveOptions type exposes the following members.

Constructors
 NameDescription
Public methodCode exampleRtfToHtmlHtmlFixedSaveOptions Initializes a new instance of the HtmlFixedSaveOptions class.
Top
Properties
 NameDescription
Public propertyContentType Gets the content-type for HTML file format.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleCssExportMode Specifies how CSS (Cascading Style Sheet) styles are exported to HTML or MHTML. Default value is Inline.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleCssFileName 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 RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleCssStream Allows to specify the stream where the CSS information will be saved to.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleEmbedImages Gets or sets a value indicating whether images are embedded directly within the HTML file in form of Base64 encoding. Default value: true.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyEncoding Gets or sets the encoding for the HTML file.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleImageFormat Gets and sets the format to embed images in the saving document. Default value: Auto.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleImageSavingCallback Allows to control how images are saved when a document is saved to HTML.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleImagesDirectoryPath Gets or sets the physical directory where all images will be saved.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleImagesDirectorySrcPath Gets or sets the relative directory that will be used when referencing images in the HTML.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleJpegQuality Gets and sets the value indicating Jpeg quality level. Affects only to the images which embedded in Jpeg format. Default value: 90.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleKeepCssStreamOpen Specifies whether keep the stream open or close it after saving an CSS information.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode examplePageBorder Specifies whether border around pages should be shown. Default is true.
Public propertyCode examplePageCount Gets or sets the number of pages to save.
Public propertyCode examplePageIndex Gets or sets the 0-based index of the first page to save. Default is 0.
Public propertyCode examplePageMargins Specifies the margins around pages. Default value is 10 points.
Public propertyCode exampleProduceOnlyHtmlBody Gets or sets a value to produce a complete HTML document or only between between <body>...</body> tags. Default value: false.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleSelectedPages Gets or sets a custom page 0-based index set for save. Setting PageIndex or PageCount properties are overrides SelectedPages.
Public propertyCode exampleSingleFontColor Sets or gets a single font color for a whole text in the produced HTML document. Default value: null.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleSingleFontFamily Sets or gets a single font family for a whole text in the HTML document. Default value: Empty.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleSingleFontSize Sets or gets a single font size in points (pt) for a whole text in the produced HTML document. Default value: null.
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleTitle Gets and sets a title for the produced HTML document. Default value: "Untitled document".
(Inherited from RtfToHtmlHtmlSaveOptions)
Public propertyCode exampleUseNumericCharacterReference 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 RtfToHtmlHtmlSaveOptions)
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 RtfToHtmlHtmlSaveOptions)
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Example
Fixed and Flowing HTML in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using SautinSoft;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            FixedAndFlowingHtml();
        }
        /// <summary>
        /// This sample shows difference between Fixed-HTML and Flowing-HTML.
        /// </summary>
        static void FixedAndFlowingHtml()
        {
            // This file is necessary to get DOCX content as byte array.
            string inpFile = @"..\..\..\example.docx";
            string htmlFixedFile = @"Fixed.html";
            string htmlFlowingFile = @"Flowing.html";

            RtfToHtml r = new RtfToHtml();

            // 1. Convert to HTML-fixed.
            // The HTML in the fixed mode represents HTML document with pages and elements positioned by (x,y).
            try
            {
                r.Convert(inpFile, htmlFixedFile, new RtfToHtml.HtmlFixedSaveOptions() { Title = "Fixed", PageMargins = 20f });
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Conversion failed! {ex.Message}");
            }

            // 2. Convert to HTML-Flowing.
            // The HTML in the flowing mode represents HTML document like a created by a human
            // extended by a whole browser width.
            try
            {
                r.Convert(inpFile, htmlFlowingFile, new RtfToHtml.HtmlFlowingSaveOptions() { Title = "Flowing"});
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Conversion failed! {ex.Message}");
            }


            // Open the results.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(htmlFixedFile) { UseShellExecute = true });
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(htmlFlowingFile) { UseShellExecute = true });
        }
    }
}
Fixed and Flowing HTML in VB.Net
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.IO
Imports SautinSoft

Namespace Example
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            FixedAndFlowingHtml()
        End Sub
        ''' <summary>
        ''' This sample shows difference between Fixed-HTML and Flowing-HTML.
        ''' </summary>
        Private Shared Sub FixedAndFlowingHtml()
            ' This file is necessary to get DOCX content as byte array.
            Dim inpFile As String = "..\..\..\example.docx"
            Dim htmlFixedFile As String = "Fixed.html"
            Dim htmlFlowingFile As String = "Flowing.html"

            Dim r As New RtfToHtml()

            ' 1. Convert to HTML-fixed.
            ' The HTML in the fixed mode represents HTML document with pages and elements positioned by (x,y).
            Try
                r.Convert(inpFile, htmlFixedFile, new RtfToHtml.HtmlFixedSaveOptions() With {
                    .Title = "Fixed",
                    .PageMargins = 20F
                })
            Catch ex As Exception
                Console.WriteLine($"Conversion failed! {ex.Message}")
            End Try

            ' 2. Convert to HTML-Flowing.
            ' The HTML in the flowing mode represents HTML document like a created by a human
            ' extended by a whole browser width.
            Try
                r.Convert(inpFile, htmlFlowingFile, New RtfToHtml.HtmlFlowingSaveOptions() With {.Title = "Flowing"})
            Catch ex As Exception
                Console.WriteLine($"Conversion failed! {ex.Message}")
            End Try


            ' Open the results.
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(htmlFixedFile) With {.UseShellExecute = True})
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(htmlFlowingFile) With {.UseShellExecute = True})
        End Sub
    End Class
End Namespace
See Also