sferyx.administration.docxhtmlconverter
Class DocxHTMLConverter

java.lang.Object
  sferyx.administration.docxhtmlconverter.DocxHTMLConverter

public class DocxHTMLConverter
extends java.lang.Object

General purpose DocxHTML Converter - this class provides fully featured generation of HTML files from various sources containing Docx content.


Field Summary
static boolean debug
           
 
Constructor Summary
DocxHTMLConverter()
          Creates a new instance of HTMLGenerator
 
Method Summary
 void addPageBreakToContentBuffer()
          Adds a HTML page break to the content buffer and all the content appended after that will be on the next page when printed
 void appendDocxToContentBuffer(java.io.File file)
          Appends the whole content of the Docx file from the File to the content buffer.
 void appendDocxToContentBuffer(java.net.URL file)
          Appends the whole content of the Docx file from the given URL to the content buffer.
 void appendHTMLContentToContentBuffer(java.lang.String content)
          Appends new HTML string to existing content buffer.
 void clearContentBuffer()
          Closes the content buffer and clears the content.
 java.lang.String closeBufferAndGenerateHTML()
          Generates the HTML content automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods.
 void closeBufferAndGenerateHTML(java.io.OutputStream destinationStream)
          Closes the existing content buffer and generates the resulting content from the DocxHTML Converter - it will be saved in the given OutputStream.
 void closeBufferAndGenerateHTML(java.lang.String destinationFile)
          Generates the HTML content automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods.
 java.lang.String generateHTMLFromContent(java.lang.String content)
          Generates HTML automatically for given image or HTML content.
 void generateHTMLFromContent(java.lang.String content, java.io.File destinationFile)
          Generates html automatically for given html content.
 void generateHTMLFromContent(java.lang.String content, java.io.OutputStream destinationStream)
          Generates HTML automatically for given image or html content.
 void generateHTMLFromContent(java.lang.String content, java.lang.String destinationFile)
          Generates the HTML automatically for given html content.
 java.lang.String generateHTMLFromDocxURL(java.lang.String sourceURL)
          Generates HTML automatically for given URL source containing a MS Word Docx file.
 void generateHTMLFromDocxURL(java.lang.String sourceURL, java.io.File destinationFile)
          Generates HTML automatically for given URL source containing a MS Word Docx file.
 void generateHTMLFromDocxURL(java.lang.String sourceURL, java.lang.String destinationFile)
          Generates HTML automatically for given URL source containing a MS Word Docx file.
 java.lang.String generateHTMLFromDocxURL(java.net.URL sourceURL)
          Generates HTML automatically for given URL source containing a MS Word Docx file.
 void generateHTMLFromDocxURL(java.net.URL sourceURL, java.io.File destinationFile)
          Generates HTML automatically for given URL source containing a MS Word Docx file.
 void generateHTMLFromDocxURL(java.net.URL sourceURL, java.io.OutputStream fos)
          Generates HTML automatically for given URL source containing a MS Word Docx file.
 void generateHTMLFromURL(java.lang.String sourceURL)
          Generates HTML automatically for given URL source.
 void generateHTMLFromURL(java.lang.String sourceURL, java.io.File destinationFile)
          Generates HTML automatically for given URL source and saves the result to destinationFile as string.
 void generateHTMLFromURL(java.lang.String sourceURL, java.io.OutputStream destinationStream)
          Generates HTML automatically for given URL source and saves the result to the given OutputStream as a string.
 void generateHTMLFromURL(java.lang.String sourceURL, java.lang.String destinationFile)
          Generates HTML automatically for given URL source and saves the result to destinationFile as a string.
 java.lang.String generateHTMLFromURL(java.net.URL sourceURL)
          Generates HTML automatically for given URL source and saves the result will be returned as a String.
 void generateHTMLFromURL(java.net.URL sourceURL, java.io.OutputStream destinationStream)
          Generates HTML automatically for given URL source and saves the result to destinationStream as string.
static void main(java.lang.String[] args)
           
 void openContentBuffer()
          Opens the new content buffer for inserting content to be used for dynamic HTML generation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Constructor Detail

DocxHTMLConverter

public DocxHTMLConverter()
Creates a new instance of HTMLGenerator

Method Detail

generateHTMLFromURL

public void generateHTMLFromURL(java.lang.String sourceURL)
                         throws java.io.UnsupportedEncodingException,
                                java.io.IOException
Generates HTML automatically for given URL source. It will display a file dialog for to specify where the generated content should be saved. The content of the URL will be recognized automatically from Docx and Images. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromURL

public void generateHTMLFromURL(java.lang.String sourceURL,
                                java.lang.String destinationFile)
                         throws java.net.MalformedURLException,
                                java.io.UnsupportedEncodingException,
                                java.io.IOException
Generates HTML automatically for given URL source and saves the result to destinationFile as a string. The content of the URL will be recognized automatically from Docx and Images. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromURL

public void generateHTMLFromURL(java.lang.String sourceURL,
                                java.io.OutputStream destinationStream)
                         throws java.net.MalformedURLException,
                                java.io.UnsupportedEncodingException,
                                java.io.IOException
Generates HTML automatically for given URL source and saves the result to the given OutputStream as a string. The content of the URL will be recognized automatically from Docx and Images etc. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromURL

public void generateHTMLFromURL(java.lang.String sourceURL,
                                java.io.File destinationFile)
                         throws java.net.MalformedURLException,
                                java.io.UnsupportedEncodingException,
                                java.io.IOException
Generates HTML automatically for given URL source and saves the result to destinationFile as string. The content of the URL will be recognized automatically from Docx and Images etc. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromURL

public void generateHTMLFromURL(java.net.URL sourceURL,
                                java.io.OutputStream destinationStream)
                         throws java.io.UnsupportedEncodingException,
                                java.io.IOException
Generates HTML automatically for given URL source and saves the result to destinationStream as string. The content of the URL will be recognized automatically from Docx and Images etc. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromURL

public java.lang.String generateHTMLFromURL(java.net.URL sourceURL)
                                     throws java.io.UnsupportedEncodingException,
                                            java.io.IOException
Generates HTML automatically for given URL source and saves the result will be returned as a String. The content of the URL will be recognized automatically from Docx and Images etc. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromDocxURL

public void generateHTMLFromDocxURL(java.lang.String sourceURL,
                                    java.lang.String destinationFile)
                             throws java.net.MalformedURLException,
                                    java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates HTML automatically for given URL source containing a MS Word Docx file. The result will be saved to the given destinationFile. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromDocxURL

public void generateHTMLFromDocxURL(java.lang.String sourceURL,
                                    java.io.File destinationFile)
                             throws java.net.MalformedURLException,
                                    java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates HTML automatically for given URL source containing a MS Word Docx file. The result will be saved to the given destinationFile. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromDocxURL

public void generateHTMLFromDocxURL(java.net.URL sourceURL,
                                    java.io.File destinationFile)
                             throws java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates HTML automatically for given URL source containing a MS Word Docx file. The result will be saved to the given destinationFile. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromDocxURL

public void generateHTMLFromDocxURL(java.net.URL sourceURL,
                                    java.io.OutputStream fos)
                             throws java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates HTML automatically for given URL source containing a MS Word Docx file. The result will be saved to the given OutputStream. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromDocxURL

public java.lang.String generateHTMLFromDocxURL(java.net.URL sourceURL)
                                         throws java.io.UnsupportedEncodingException,
                                                java.io.IOException
Generates HTML automatically for given URL source containing a MS Word Docx file. The result will be returned as a String. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromDocxURL

public java.lang.String generateHTMLFromDocxURL(java.lang.String sourceURL)
                                         throws java.io.UnsupportedEncodingException,
                                                java.io.IOException,
                                                java.net.MalformedURLException
Generates HTML automatically for given URL source containing a MS Word Docx file. The result will be returned as a String. All images will be embedded in the HTML code as base64 encoded strings

Throws:
java.io.UnsupportedEncodingException
java.io.IOException
java.net.MalformedURLException

openContentBuffer

public void openContentBuffer()
Opens the new content buffer for inserting content to be used for dynamic HTML generation. This should be used in conjuction with closeBufferAndGeneratePDF() and appendXXXContentToContentBuffer(String content) methods.


appendHTMLContentToContentBuffer

public void appendHTMLContentToContentBuffer(java.lang.String content)
Appends new HTML string to existing content buffer. This should be used in conjuction with openContentBuffer() and closeBufferAndGeneratePDF(). The HTML content will be appended to existing content previously appended for example from Docx files. See closeBufferAndGenerateHTML for how to create the resaulting HTML content.


appendDocxToContentBuffer

public void appendDocxToContentBuffer(java.net.URL file)
Appends the whole content of the Docx file from the given URL to the content buffer. See closeBufferAndGenerateHTML for how to create the resaulting HTML content.


appendDocxToContentBuffer

public void appendDocxToContentBuffer(java.io.File file)
Appends the whole content of the Docx file from the File to the content buffer. See closeBufferAndGenerateHTML for how to create the resaulting HTML content.


addPageBreakToContentBuffer

public void addPageBreakToContentBuffer()
Adds a HTML page break to the content buffer and all the content appended after that will be on the next page when printed


closeBufferAndGenerateHTML

public void closeBufferAndGenerateHTML(java.io.OutputStream destinationStream)
                                throws java.io.UnsupportedEncodingException,
                                       java.io.IOException
Closes the existing content buffer and generates the resulting content from the DocxHTML Converter - it will be saved in the given OutputStream. This should be used in conjuction with openContentBuffer() and appendContentToContentBuffer(String content). These methods are very useful in environments where long content srings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

closeBufferAndGenerateHTML

public void closeBufferAndGenerateHTML(java.lang.String destinationFile)
                                throws java.io.UnsupportedEncodingException,
                                       java.io.IOException
Generates the HTML content automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods. It will generate the file to the given destinationFile.

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

closeBufferAndGenerateHTML

public java.lang.String closeBufferAndGenerateHTML()
                                            throws java.io.UnsupportedEncodingException,
                                                   java.io.IOException
Generates the HTML content automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods. The resulting content is returned as a String.

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

clearContentBuffer

public void clearContentBuffer()
Closes the content buffer and clears the content.


generateHTMLFromContent

public void generateHTMLFromContent(java.lang.String content,
                                    java.io.OutputStream destinationStream)
                             throws java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates HTML automatically for given image or html content. Images will be embedded in the HTML code as base64 encoded strings. It will generate the HTML file and save it to the given OutputStream.

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromContent

public java.lang.String generateHTMLFromContent(java.lang.String content)
                                         throws java.io.UnsupportedEncodingException,
                                                java.io.IOException
Generates HTML automatically for given image or HTML content. Images will be embedded in the HTML code as base64 encoded strings. It will generate the HTML file and return the resulting HTML String.

Throws:
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromContent

public void generateHTMLFromContent(java.lang.String content,
                                    java.lang.String destinationFile)
                             throws java.io.FileNotFoundException,
                                    java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates the HTML automatically for given html content. Images will be embedded in the HTML code as base64 encoded strings. The resulting HTML content will be saved to the given destinationFile

Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
java.io.IOException

generateHTMLFromContent

public void generateHTMLFromContent(java.lang.String content,
                                    java.io.File destinationFile)
                             throws java.io.FileNotFoundException,
                                    java.io.UnsupportedEncodingException,
                                    java.io.IOException
Generates html automatically for given html content. Images will be embedded in the HTML code as base64 encoded strings. The resulting HTML content will be saved to the given destinationFile

Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
java.io.IOException

main

public static void main(java.lang.String[] args)