HtmlFixedSaveOptions Class |
Represents options for saving to fixed HyperText Markup Language (HTML) format.
Inheritance Hierarchy Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.11.20
Syntax public sealed class HtmlFixedSaveOptions : HtmlSaveOptions
Public NotInheritable Class HtmlFixedSaveOptions
Inherits HtmlSaveOptions
The HtmlFixedSaveOptions type exposes the following members.
Constructors Properties | Name | Description |
---|
| PageBorder |
Specifies whether border around pages should be shown.
Default is true.
|
| PageCount |
Gets or sets the number of pages to save.
|
| PageIndex |
Gets or sets the 0-based index of the first page to save. Default is 0.
|
| PageMargins |
Specifies the margins around pages.
Default value is 10 points.
|
| SelectedPages |
Gets or sets a custom page 0-based index set for save.
Setting PageIndex or
PageCount properties are overrides
SelectedPages.
|
TopExample See Developer Guide: Save document as HTML (in the Fixed and Flowing modes)
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();
}
static void SaveToHtmlFile()
{
string inputFile = @"..\..\..\example.docx";
DocumentCore dc = DocumentCore.Load(inputFile);
string fileHtmlFixed = @"Fixed-as-file.html";
string fileHtmlFlowing = @"Flowing-as-file.html";
dc.Save(fileHtmlFixed, new HtmlFixedSaveOptions()
{
Version = HtmlVersion.Html5,
CssExportMode = CssExportMode.Inline
});
dc.Save(fileHtmlFlowing, new HtmlFlowingSaveOptions()
{
Version = HtmlVersion.Html5,
CssExportMode = CssExportMode.Inline,
ListExportMode = HtmlListExportMode.ByHtmlTags
});
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(fileHtmlFixed) { UseShellExecute = true });
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(fileHtmlFlowing) { UseShellExecute = true });
}
static void SaveToHtmlStream()
{
byte[] fileData = null;
string fileHtmlFixed = @"Fixed-as-stream.html";
string fileHtmlFlowing = @"Flowing-as-stream.html";
DocumentCore dc = new DocumentCore();
dc.Content.End.Insert("Hey Guys and Girls!");
using (MemoryStream ms = new MemoryStream())
{
dc.Save(ms, new HtmlFixedSaveOptions());
fileData = ms.ToArray();
File.WriteAllBytes(fileHtmlFixed, fileData);
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
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"
dc.Save(fileHtmlFixed, New HtmlFixedSaveOptions() With {
.Version = HtmlVersion.Html5,
.CssExportMode = CssExportMode.Inline
})
dc.Save(fileHtmlFlowing, New HtmlFlowingSaveOptions() With {
.Version = HtmlVersion.Html5,
.CssExportMode = CssExportMode.Inline,
.ListExportMode = HtmlListExportMode.ByHtmlTags
})
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
Sub SaveToHtmlStream()
Dim fileData() As Byte = Nothing
Dim fileHtmlFixed As String = "Fixed-as-stream.html"
Dim fileHtmlFlowing As String = "Flowing-as-stream.html"
Dim dc As New DocumentCore()
dc.Content.End.Insert("Hey Guys and Girls!")
Using ms As New MemoryStream()
dc.Save(ms, New HtmlFixedSaveOptions())
fileData = ms.ToArray()
File.WriteAllBytes(fileHtmlFixed, fileData)
dc.Save(ms, New HtmlFlowingSaveOptions())
fileData = ms.ToArray()
File.WriteAllBytes(fileHtmlFlowing, fileData)
End Using
End Sub
End Module
See Also