Class ODFCreator

All Implemented Interfaces:
IHTMLHandler, IDocumentCreator

@OpenApiAll public class ODFCreator extends AbstractDocumentCreator implements IHTMLHandler
The class use for create ODF content.
Since:
May 21, 2009
  • Constructor Details

    • ODFCreator

      public ODFCreator()
  • Method Details

    • convert

      public void convert(Reader reader, Writer writer) throws IOException
      Convert the HTML content from reader into ODF document.
      Specified by:
      convert in interface IDocumentCreator
      Parameters:
      reader - the reader containing HTML source.
      writer - the writer containing RTF document.
      Throws:
      IOException - If any IO errors occur.
      See Also:
    • comment

      public void comment(char[] data)
      Receive notification of comment data.
      Specified by:
      comment in interface IHTMLHandler
      Parameters:
      data - An array holding the characters in the comment.
    • startTag

      public void startTag(HTML.Tag tag, AttributeSet attributes)
      Receive notification of the start of a tag.
      Specified by:
      startTag in interface IHTMLHandler
      Parameters:
      tag - HTML tag
      attributes - The attributes attached to the tag. If there are no attributes, it shall be an empty Attributes object.
    • endTag

      public void endTag(HTML.Tag tag)
      Receive notification of the end of a tag.
      Specified by:
      endTag in interface IHTMLHandler
      Parameters:
      tag - HTML tag
    • characters

      public void characters(char[] data)
      Receive notification of character data inside a tag.
      Specified by:
      characters in interface IHTMLHandler
      Parameters:
      data - The characters.
    • endDocument

      public void endDocument()
      Receive notification of end document tag.
      Specified by:
      endDocument in interface IHTMLHandler
      See Also:
    • putAttributeToStack

      public void putAttributeToStack(AttributeSet attributes)
      put start tag attributes in to htmlTagStack.
      Parameters:
      attributes - set of attribute
    • convertToODF

      public String convertToODF(String tagName, ArrayList<Attribute> attributes, Deque<String> contentStack)
      convert html to ODF.
      Parameters:
      tagName - HTML tag
      attributes - list of attributes
      contentStack - content of HTML
      Returns:
      ODF format
    • setPaperHeight

      public void setPaperHeight(float h)
      Set paper height.
      Specified by:
      setPaperHeight in interface IDocumentCreator
      Parameters:
      h - paper height.
      See Also:
    • getPaperHeight

      public float getPaperHeight()
      Get paper height.
      Returns:
      paper height
    • setPaperWidth

      public void setPaperWidth(float w)
      Set paper width.
      Specified by:
      setPaperWidth in interface IDocumentCreator
      Parameters:
      w - paper width.
      See Also:
    • getPaperWidth

      public float getPaperWidth()
      Return a paperWidth.
      Returns:
      the paperWidth in (inch?) unit
    • calculateCellWidth

      public double[] calculateCellWidth()
      Calculate table and td width
      Returns:
      width (inch) for each cell by index
    • changeColorFormat

      public String changeColorFormat(String color)
      Change color(3-digits RGB, 6-digits RGB and color name) to RGB format.
      Parameters:
      color - color format
      Returns:
      RGB format and return empty String when invalid color format.
    • setProperties

      public void setProperties(Properties properties)
      Not Implemented.
      Specified by:
      setProperties in interface IDocumentCreator
      Parameters:
      properties - the properties
    • setDocumentPage

      public void setDocumentPage(com.nomagic.magicreport.DocumentPage page)
      Description copied from interface: IDocumentCreator
      set document page property.
      Specified by:
      setDocumentPage in interface IDocumentCreator
      Parameters:
      page - page property.
    • setReduceTableSize

      public void setReduceTableSize(boolean reduce)
      Set reduce table size. If true, the table size will be reduce to paper width; Otherwise, retain table size as defined in table style.
      Parameters:
      reduce - true to reduce table size with paper width