This interface allows Docx to HTML V2.0 to be invoked from Java programs. version 11 or later. See Java VM Issues.
The Java Interface uses JNI (JavaNativeInterface).
The following library files are included in [Install directory] or [Install directory]/lib.
Library file | Contents | Location |
---|---|---|
DhcJavaCtl.jar | Java Archive | [Install directory]/lib |
DhcJavaCtl20.dll | Java Interface Library for Windows | [Install directory] |
libDhcJavaCtl20.so | Java Interface Library for Linux | [Install directory]/lib |
In order to execute the Java Interface, directory of execute java and [Install directory]/lib/DhcJavaCtl.jar must be included in the CLASSPATH environment variable. In addition, from using JNI (JavaNativeInterface), in Windows version, [Install directory] must be included in the PATH environment variable. In the following environment, [Install directory]/lib must be included. In Linux version, it must be included in the LD_LIBRARY_PATH environment variable. See also Environment Variables and Symbolic Links for the necessary environment variables.
Windows version:
Linux version:
Java Interface is built using Eclipse Temurin JDK (Former AdoptOpenJDK) 11. Java runtime environments below Java 11 are not supported. Additionally using Java execution of an old version in the Linux environment could cause compatibility issues.
Since the native JNI library can be read by two or more Java VM class loaders, when using this interface in application servers, such as Tomcat, do not install the DhcJavaCtl.jar in the WEB-INF/lib of the Web application. Set the interface to be read by class loaders (system class loader etc.) which only load once.
The following classes are contained in the Java interface:
Name | Functions |
---|---|
DhcObj | Docx to HTML V2.0 class (itself). DhcObj import jp.co.antenna.DhcJavaCtl.*;
DhcObj obj;
try {
obj = new DhcObj();
// some process
catch(Exception e)
{
System.out.println(e.getMessage());
}
|
DhcObj Class provides the following methods:
Name | Return Value | Arguments | Functions |
---|---|---|---|
execute | None | None | Executes the conversion and outputs to the destination specified in setDocumentURI . |
setDocumentURI | None | newVal : java.lang.String | Specify the input file name.
|
setOutputFilePath | None | newVal : java.lang.String | Specify the output file name.
|
clrSettings | None | None | Clears option settings. |
lodeSettings | None | newVal : java.lang.String | Loads specified option setting file.
|
setEnableXHTML | None | newVal : boolean | Specifies the grammar for tag output.
|
setViewportContent | None | content : java.lang.String | Specifies to output the meta tag in the following format in the <head>. <meta name="viewport" content=" Content specified in ‘content’">
|
setEnableENDL | None | newVal : boolean | Specifies whether to output a line break at the end of the block tag.
|
setEnableEmptyParagraph | None | newVal : boolean | blank lines (lines with line breaks only) in Word.
|
setEnableNonRefId | None | newVal : boolean | While editing in Word, a lot of IDs that are not internally deleted may be created. Specifies whether these internally unreferenced IDs should be removed in HTML output. |
setEnableImgWidth | None | newVal : boolean | Specifies whether to output the width of the image.
|
setEnableHeadingStrong | None | newVal : boolean | Specifies whether to ignore the emphasis specified in the heading style.
|
setEnableEmbedimage | None | newVal : boolean | Specifies whether to embed the image in the body HTML as a data URL.
|
setEnableMathML | None | newVal : boolean | Specifies whether to output to <img> tags in MathML format for formulas edited in the Word Equation Editor.
|
setXmlMathML | None | newVal : boolean | Specifies whether to output to MathML formatted markup for formulas edited in the Word Equation Editor.
|
setOMath | None | newVal : boolean | Specifies whether to output to Word's own Office Math format for formulas edited in the Word Equation Editor.
|
setThroughImage | None | newVal : boolean | Specifies whether to output the image in its original format inserted into Word.
|
setEnablePStyle | None | newVal : boolean | Specifies whether to output the style name of the paragraph by setting it as the value of the class attribute.
|
setEnableCitation | None | newVal : boolean | Specifies whether to outputs the value of tag in the Citation field by setting it as the value of the href attribute of the <a> tag.
|
setTextColor | None | newVal : boolean | Specifies whether to outputs the color specified for the text as <span style="color:color value">.
|
setItalic | None | newVal : int | Specifies the output method when italics are specified for text.
|
setUnderline | None | newVal : int | Specifies the output method when underline is specified for text.
|
setLinethrough | None | newVal : int | Specifies the output method when strikethrough is specified for text.
|
setEncoding | None | newVal : java.lang.String | Specifies the character code (encoding method) of the HTML file. (default : "UTF-8")
|
setDefstyle | None | newVal : boolean | Specifies whether to output the <style> element (element specifying the default CSS style) in <head>.
|
setSpaceIndent | None | newVal : boolean | Specifies whether to convert the indentation to a a single full-width space when one or more characters of indentation are specified at the beginning of the paragraph.
|
setOutputBR | None | newVal : boolean | Specifies whether to output <br> tags at the end of paragraphs instead of enclosing them in <p> tags. It is invalid when XML grammar is specified in tag output.
|
setFileimages | None | newVal : boolean | Specifies how to name the folder that stores image files.
|
setCSS | None | uri : java.lang.String media : java.lang.String |
Specifies the CSS file to link.
|
setJS | None | newVal : java.lang.String | Place the script tag in <head> and specify the path (URL) of the JavaScript file in its src attribute.
|
saveSettings | None | newVal : java.lang.String | Specify the path of the option setting file. |
setTablestyle | None | newVal : boolean | Specifies whether to output the table-style.
|
setSplit | None | newVal : int | You can specify the outline level at which HTML <section> (or <div class=‘section-area’>) tags are output.
|
setEnableTocout | None | newVal : boolean | When "setSplit" is called, the table of contents inserted by the Word table of contents function 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
|
setPagenavi | None | newVal : java.lang.String | You can specify the outline level at which HTML <section> (or <div class=‘section-area’>) tags are output.
|
setLang | None | newVal : java.lang.String | You can specify the language (lang attribute) to be output in the <html> tag of the output HTML file.
|
setSection | None | newVal : int | You can specify the outline level at which HTML <section> (or <div class=‘section-area’>) tags are output.
|
setEndnoteId | None | newVal : boolean | When inserting endnotes in a Word document, if the start number of the sequential number of the endnote is set to a number other than ‘1’, you can match the number of the endnote character (<sup> tag) in the output HTML and the number used at the end of the ‘id’ specifying the endnote.
|
setFootnote | None | newVal : int | Specifies how footnotes are output to html when they are present in a Word document.
|
setCustomSep | None | newVal : boolean | If footnotes and endnotes are inserted, specifies the boundaries with the body text.
|
[Install directory]/samples/java includes simple sample programs.
To run this sample program in the [Working directory], do the following:
Copy the directory under samples to [Working directory]. At this time, include [Working directory]/samples/java in the CLASSPATH.