Click or drag to resize

RtfToHtmlHtmlSaveOptions Class

Represents a base class for saving options to HyperText Markup Language (HTML) format.
Inheritance Hierarchy

Namespace: SautinSoft
Assembly: SautinSoft.RtfToHtml (in SautinSoft.RtfToHtml.dll) Version: 2024.6.6
Syntax
public abstract class HtmlSaveOptions

The RtfToHtmlHtmlSaveOptions type exposes the following members.

Properties
 NameDescription
Public propertyContentType Gets the content-type for HTML file format.
Public propertyCode exampleCssExportMode Specifies how CSS (Cascading Style Sheet) styles are exported to HTML or MHTML. Default value is Inline.
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.
Public propertyCode exampleCssStream Allows to specify the stream where the CSS information will be saved to.
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.
Public propertyEncoding Gets or sets the encoding for the HTML file.
Public propertyCode exampleImageFormat Gets and sets the format to embed images in the saving document. Default value: Auto.
Public propertyCode exampleImageSavingCallback Allows to control how images are saved when a document is saved to HTML.
Public propertyCode exampleImagesDirectoryPath Gets or sets the physical directory where all images will be saved.
Public propertyCode exampleImagesDirectorySrcPath Gets or sets the relative directory that will be used when referencing images in the HTML.
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.
Public propertyCode exampleKeepCssStreamOpen Specifies whether keep the stream open or close it after saving an CSS information.
Public propertyCode exampleProduceOnlyHtmlBody Gets or sets a value to produce a complete HTML document or only between between <body>...</body> tags. Default value: false.
Public propertyCode exampleSingleFontColor Sets or gets a single font color for a whole text in the produced HTML document. Default value: null.
Public propertyCode exampleSingleFontFamily Sets or gets a single font family for a whole text in the HTML document. Default value: Empty.
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.
Public propertyCode exampleTitle Gets and sets a title for the generated HTML document. If none is provided, it tries to find an embedded 'title' from the original document. None are found, so it writes "Untitled document". Default: null.
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.
Public propertyCode exampleVersion Specifies version of HTML standard that should be used when saving the document to HTML or MHTML. Default value is Xhtml.
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
Convert RTF file to HTML file 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)
        {
            ConvertRtfToHtml();
        }
        /// <summary>
        /// Converts RTF file to HTML file.
        /// </summary>
        static void ConvertRtfToHtml()
        {
            string inpFile = @"..\..\..\example.rtf";
            string outfile = Path.GetFullPath("Result.html");

            RtfToHtml r = new RtfToHtml();
            r.Convert(inpFile, outfile, new RtfToHtml.HtmlFixedSaveOptions() {Title = "SautinSoft Example." });

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outfile) { UseShellExecute = true });
        }
    }
}
Convert RTF file to HTML file 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)
            ConvertRtfToHtml()
        End Sub
        ''' <summary>
        ''' Converts RTF file to HTML file.
        ''' </summary>
        Private Shared Sub ConvertRtfToHtml()
            Dim inpFile As String = "..\..\..\example.rtf"
            Dim outfile As String = Path.GetFullPath("Result.html")

            Dim r As New RtfToHtml()
            r.Convert(inpFile, outfile, new RtfToHtml.HtmlFixedSaveOptions() With {.Title = "SautinSoft Example."})

            ' Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outfile) With {.UseShellExecute = True})
        End Sub
    End Class
End Namespace
See Also