Features: Add-in and Command Line

 

Easy to create with add-in


If you have Microsoft Word installed on your computer, add the Word add-in when you install "HTML on Word"; the Word add-in allows you to immediately output an HTML file from the Word document you are editing.

This can be done at any time while editing, so you can easily preview your creation.

 

func01-04

 

Options

The add-in allows the following options to be specified during conversion.

button-convert2

 

Use specified CSS

You can specify a CSS file to be linked to HTML. The specified CSS file will be saved in the same folder as the HTML, and you can check the web page with the style reflected.

Line break with block tag

For the output HTML source code (strings to be written), you can specify whether or not to break lines after the closing tag of a block tag (h, p, table, etc.). The default setting is no line breaks. This can reduce HTML size by not outputting line feeds, but it also reduces readability because all code is generated on a single line.
By specifying the option, you can add line feed codes and output HTML with highly readable source code.

 

image29

Output HTML source code [left: without line feed code, right: with line feed code]

 

In addition, by specifying the destination folder, an HTML file is produced simply by clicking the "Convert to HTML" button and is displayed in the associated program.
If a file with the extension "html" is associated with a web browser, the conversion results can be viewed immediately in that web browser.

 

Supports command line


"Word2HTML", the program that analyzes docx and convert into HTML, the core of "HTML on Word", can be run directly from the command line (Windows command prompt or any program that can execute commands).

When executed from the command line, various options can be specified to output HTML with more detailed conversion settings.

 

func01-05

In addition, by saving the conversion settings in a file, you can easily convert with the same settings by specifying the settings file at runtime from the command line.

Note: The setting file can also be used as the default settings for conversions from the add-in by saving it in a predetermined directory.

How to use command

To perform the conversion from the command line, start the Windows command prompt, specify the command line program "Word2HTML.exe", enter the location/file name of the input file (docx) and output file (html), the optional command you want to use and execute (press Enter).

 

Example (The following three items are required):

Command program location and name

The default folder is: C:\Program Files\Antenna House\xhw12\Word2HTML.exe

Location and name of the original docx file to be converted

e.g., c:\document\manual.docx

Location and name of the converted html file

e.g., c:\out\index.html

 

Actual command

Word2HTML.exe c:\document\manual.docx c:\out\index.html

 

Example with XHTML 1.0, with line feed code, and CSS file (c:\document\sample.css) options in addition to the above:

Actual command

Word2HTML.exe c:\document\manual.docx c:\out\index.html -xhtml -endl -css c:\document\sample.css

 

Command and option list

Parameter

Description

<input-file>

(Required) Specify the input file name including file path.
The <input-file> statement is not necessary, but directly describes the name of the input file.

<output-file>

Specify the output file name including file path. If not specified, the output will be an HTML file (extension:.html) with the same file name and in the same folder as the input file.
The <output-file> statement is not necessary, but directly describes the name of the input file.

-clrsettings

When this option is specified, option settings already specified in the default setting file, etc. will be cleared.

Notice:
If this parameter is not specified, some options will be set as duplicate as specified in the default setting file or additionally set, so please specify this parameter if you do not want them to be duplicated or additionally set.

-settings <settings-file>

Reads the conversion option setting file specified in <settings-file>.

-xhtml

By default, output HTML grammar tags. If -xhtml is specified, XML grammar tags are output.

Also, <section>/<nav> tags are output as <div class="section-area">/<div class="nav-area"> tags, respectively.

-viewport <content>

Outputs a meta tag of the following format to <head>.

<meta name=”viewport” content=” Content specified in ‘content’”>

-endl

Outputs a line break at the end of the block tag.

-emptyP

By default, blank lines (lines with line breaks only) in Word are ignored when outputting HTML. When this option is specified, empty <p></p> tags are output as many as the number of blank lines.

-nonrefiid

While editing in Word, many IDs are created that are not internally referenced. By default, this converter scans for IDs that have no internal references and removes them when generating HTML. However, when this option is specified, unreferenced IDs will be retained and not deleted.

-imgwidth

Outputs the width of the image to the style attribute of the <img> tag in the size pasted into the Word document.

-hstrong

Ignores the emphasis specified in the heading style.

-embedimg

When this option is not specified (default), images are output to the image folder.

When this option is specified, the images are embedded in the body HTML with a data URL.

-(x|o)math

Specifies the output format for formulas edited in the Word formula editor. The following four output formats can be specified:

Unspecified: Output formulas to <img> tags as files in svg file format.

-math: Output formulas to <img> tags as files in MathML format.

-xmath: Output formulas in MathML format markup.

-omath: Output formulas in Word's own Office Math format.

-throughimg

Outputs the image in its original format inserted into Word.

-pstyle

Outputs the style name of the paragraph specified in Word by setting it as the value of the class attribute. Style names other than single-byte alphanumeric characters and some single-byte symbols are not output in the value of the class attribute.

-citation

Outputs the value of tag in the Citation field by setting it as the value of the href attribute of the <a> tag.

-tablestyle

Outputs the background color, border thickness, color, style (only some styles are supported), and table width specified for tables and table cells in a Word document using the style attribute of each HTML tag.

-textcolor

Outputs the color specified for the text as <span style="color:color value">.

-italic n|t|s

Specifies the output method when italics are specified for text:

-italic n: Do not output. (default)

-italic t: Output as <i>tag.

-italic s: Output as <span style="font-style:italic

Note that if the font displayed by the web browser does not have italics, it will not be displayed in italics.

-underline n|t|s

Specifies the output method when underline is specified for text:

-underline n: Do not output. (default)

-underline t: Output as <u> tag.

-underline s: Output as <span style="text-decoration-line:underline;">.

-linethrough n|t|s

Specifies the output method when strikethrough is specified for text:

-linethrough n: Do not output. (default)

-linethrough t: Outputs as <del> tag.

-linethrough s: Outputs as <span style="text-decoration-line: line-through;">.

-encoding <encoding>

When you want to specify a character code (encoding method) other than Unicode's UTF-8 for HTML files, specify the encoding method with this parameter.

-encoding Shift_JIS: Output in Shift-JIS (see Note 1)

-encoding UTF-16: Unicode's UTF-16 encoding

Note 1: Because fewer character types are specified in Shift-JIS than in Unicode, Unicode characters that cannot be handled by Shift-JIS are output as &#x character_number; (character_number is a hexadecimal number). Note that the old model-dependent characters added by Microsoft to JIS X0208 (e.g., ①, ②) are treated as Shift-JIS characters.

-split 1|2|3

When this parameter is specified, the HTML file is split and output according to the outline level of the Word document. Outline level can be specified from 1 to 3.

-tocout

When this parameter is specified, the table of contents inserted by the Word table of contents function when the -split parameter is specified is output as a separate HTML file (inc-toc.html).

The inc-toc.html file can be included in the split HTML file using JavaScript. inc-toc.html does not output tags such as <head> and <body> other than the tags for the table of contents.

Please refer to the following web page for a sample of how to include a table of contents using JavaScript.

https://www.antennahouse.com/html-on-word-samples

If this parameter is not specified, the table of contents will be output at the top of all the split HTML files.

-pagenavi language

When this parameter is specified, links to the previous and next pages are output at the top (immediately after the table of contents, if any) and bottom of the HTML file that was split when the -split parameter was specified.

If "ja" is specified in the "language" field following -pagenavi, "前へ" and "次へ" links are output in Japanese.

If you specify anything other than "ja" in the "language" field or omit it, "Prev" and "Next" links will be output in English.

If the previous or next page does not exist, each link is omitted.

-lang language

With this option, you can specify the language (lang attribute) to be output in the <html> tag of the output HTML file. Specify the language code in the "language" field following -lang. (e.g. "ja" for Japanese, "en" for English.)

If "none" is specified for "language", the lang attribute is not output to the <html> tag.

If this option is not specified, or if values other than single-byte alphanumeric characters or single-byte hyphens are specified, "ja" (Japanese) or "en" (English) is output, inferred from the Word document.

If the "-xhtml" parameter is specified, the language code specified for the xml:lang attribute and lang attribute of the <html> tag, respectively, is output.

e.g. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">

-defstyle

When this option is specified, the <style> element (element specifying the default CSS style) in <head> is not output.

-spaceindent

When this option is specified, the indentation is converted to a single full-width space when one or more indentations are specified at the beginning of a paragraph.

-outputbr

Instead of enclosing a paragraph in a <p> tag, a <br> tag is output at the end of the paragraph. This is invalid when -xhtml parameter is specified.

-fileimages

Name the folder that stores image files as "destination_file_name.images".

-css cssfile [media]

Links the CSS file. Place the CSS file in a folder on Windows and specify its path. An error will occur if the specified CSS file does not exist. You can optionally specify “media”.

Outputs a link tag of the following format in <head>. (if media is specified)

<link rel="stylesheet" href="xxx.css" media="print">

The specified CSS file is copied to the HTML output destination folder.

You can specify multiple pairs of -css and CSS files.

If the "-xhtml" parameter is specified, <meta> and <link> tags will be output.

<meta http-equiv="Content-Style-Type" content="text/css" />

<link rel="stylesheet" href="xxx.css" type="text/css" media="print" />

-js javascript-path

Place the script tag in <head> and specify the path (URL) of the JavaScript file in its src attribute. The JavaScript file will not be copied to the specified location, so please save the JavaScript file to the specified file path.

No error will occur even if the specified JavaScript path does not exist.

You can specify multiple pairs of -js and JavaScript files.

If the "-xhtml" parameter is specified, <meta> and <script> tags will be output.

<meta http-equiv="Content-Script-Type" content="text/javascript" />

<script type="text/javascript" src="xxx.js"></script>

-savesettings <settings-file>

Saves the specified values of the conversion option parameters at command line execution with the file name specified in <settings-file>.

-savedefault

Outputs the specified values of conversion option parameters at command line execution to the default settings file (def-settings.xml).

For detailed specifications, please refer to "Command-line version" in the online manual.