Codecs: How to convert HTML to DOCX?
In This Topic
SDK can convert HTML document to a DOCX document.
SDK supports the following HTML-tags:
a, abbr, acronym, article, b, big, blockquote, body, br, caption, center, code, col, colgroup, dd, div, dl, dt, em, embed, figcaption, figure, font, footer, h1, h2, h3, h4, h5, h6, header, hr, i, img, li, ol, p, pre, q, s, section, small, span, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul.
SDK supports the following CSS-attributes:
background-color, border, border-bottom, border-bottom-color, border-bottom-style, border-bottom-width, border-collapse, border-color, border-left, border-left-color, border-left-style, border-left-width, border-right, border-right-color, border-right-style, border-right-width, border-style, border-top, border-top-color, border-top-style, border-top-width, border-width, color, display, font, font-family, font-size, font-style, font-variant, font-weight, height, line-height, list-style-type, margin, margin-block-end, margin-block-start, margin-bottom, margin-left, margin-right, margin-top, maring-inline-end, maring-inline-start, padding, padding-bottom, padding-left, padding-right, padding-top, page-break-before, text-align, text-decoration, text-decoration-color, text-decoration-line, text-decoration-style, text-decoration-thickness, text-indent, text-transform, vertical-align, white-space, width.
CSS-attributes are supported only in "style" attribute of HTML-tag. External CSS-styles are not supported yet.
Here is C#/VB.NET code that shows how to convert HTML document to a DOCX document:
/// <summary>
/// Converts HTML document to a DOCX document.
/// </summary>
public static void ConvertHtmlToDocx(string htmlFilePath, string docxFilePath)
{
Vintasoft.Imaging.Office.OpenXml.OpenXmlDocumentConverter.ConvertHtmlToDocx(htmlFilePath, docxFilePath);
}
''' <summary>
''' Converts HTML file to a DOCX file.
''' </summary>
Public Shared Sub ConvertHtmlToDocx(htmlFilePath As String, docxFilePath As String)
Vintasoft.Imaging.Office.OpenXml.OpenXmlDocumentConverter.ConvertHtmlToDocx(htmlFilePath, docxFilePath)
End Sub