216 x 279 mm.

Namespace:  SautinSoft
Assembly:  SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 7.1.4.17

Syntax

      
 C#  Visual Basic 
public void Letter()
Public Sub Letter

Examples

CopyASP.Net - Convert ASPX page to DOCX using C#
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;

public partial class _Default : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        Result.Text = "";
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        byte[] docxBytes = null;

        SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

        // After purchasing the license, please insert your serial number here to activate the component.
        // h.Serial = "XXXXXXXXX";

        // Page properties.
        h.PageStyle.PageSize.Letter();
        h.PageStyle.PageMarginLeft.Mm(25);

        if (h.OpenHtml(Path.Combine(Server.MapPath(""), @"Default.aspx")))
            docxBytes = h.ToDocx();

        // Show result in the default DOCX viewer app.
        if (docxBytes != null)
        {
            Response.Clear();
            Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            Response.AddHeader("content-disposition", "inline; filename=\"Result.docx\"");
            Response.BinaryWrite(docxBytes);
            Response.Flush();
            Response.End();
        }
        else
        {
            Result.Text = "Converting failed!";
        }
    }
}
CopyASP.Net - Convert ASPX page to DOCX using VB.Net
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO
Imports System.Net

Partial Public Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Result.Text = ""
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim docxBytes() As Byte = Nothing

        Dim h As New SautinSoft.HtmlToRtf()

        ' After purchasing the license, please insert your serial number here to activate the component.
        'h.Serial = "XXXXXXXXX"


        ' Page properties.
        h.PageStyle.PageSize.Letter()
        h.PageStyle.PageMarginLeft.Mm(25)

        If h.OpenHtml(Path.Combine(Server.MapPath(""), "Default.aspx")) Then
            docxBytes = h.ToDocx()
        End If

        ' Show result in the default DOCX viewer app.
        If docxBytes IsNot Nothing Then
            Response.Clear()
            Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
            Response.AddHeader("content-disposition", "inline; filename=""Result.docx""")
            Response.BinaryWrite(docxBytes)
            Response.Flush()
            Response.End()
        Else
            Result.Text = "Converting failed!"
        End If
    End Sub
End Class

See Also