RtfToHtmlHtmlSaveOptionsProduceOnlyHtmlBody Property |
Gets or sets a value to produce a complete HTML document or only between between <body>...</body> tags. Default value: false.
Namespace: SautinSoftAssembly: SautinSoft.RtfToHtml (in SautinSoft.RtfToHtml.dll) Version: 2025.4.24
Syntaxpublic bool ProduceOnlyHtmlBody { get; set; }
Public Property ProduceOnlyHtmlBody As Boolean
Get
Set
Property Value
Boolean
Remarks
In case of 'True' you will get only HTML between <body>...</body> tags.
This property will be useful to merge multiply HTML documents into a single.
ExampleProduce only HTML body 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)
{
ProduceOnlyHtmlBody();
}
static void ProduceOnlyHtmlBody()
{
string inpFile = @"..\..\..\example.docx";
string outFile = @"Result.html";
RtfToHtml r = new RtfToHtml();
RtfToHtml.HtmlFlowingSaveOptions opt = new RtfToHtml.HtmlFlowingSaveOptions()
{
ProduceOnlyHtmlBody = true
};
try
{
r.Convert(inpFile, outFile, opt);
}
catch (Exception ex)
{
Console.WriteLine($"Conversion failed! {ex.Message}");
}
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
}
}
Produce only HTML body 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)
ProduceOnlyHtmlBody()
End Sub
Private Shared Sub ProduceOnlyHtmlBody()
Dim inpFile As String = "..\..\..\example.docx"
Dim outFile As String = "Result.html"
Dim r As New RtfToHtml()
Dim opt As New RtfToHtml.HtmlFlowingSaveOptions() With {
.ProduceOnlyHtmlBody = True
}
Try
r.Convert(inpFile, outFile, opt)
Catch ex As Exception
Console.WriteLine($"Conversion failed! {ex.Message}")
End Try
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
End Sub
End Class
End Namespace
See Also