Class RTFCreator

All Implemented Interfaces:
IHTMLHandler, IDocumentCreator

@OpenApiAll public class RTFCreator extends AbstractDocumentCreator implements IHTMLHandler
The class use for create RTF content.
Since:
May 22, 2009
  • Field Details

  • Constructor Details

    • RTFCreator

      public RTFCreator()
  • Method Details

    • convert

      public void convert(Reader reader, Writer writer) throws IOException
      Convert the HTML content from reader into RTF 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.
    • 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.
    • addTableProperties

      public void addTableProperties(String tagName, String attributeName, String value)
      Add tag and value of align/valign or bgcolor to stack.
      Parameters:
      tagName - tagName
      attributeName - attributeName
      value - value
    • setPaperHeight

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

      public double 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 double getPaperWidth()
      Get paper width.
      Returns:
      paper width
    • setProperties

      public void setProperties(Properties properties)
      Set properties.
      Specified by:
      setProperties in interface IDocumentCreator
      Parameters:
      properties - properties
    • getProperties

      public Properties getProperties()
      Get properties.
      Returns:
      properties
    • checkRowSpan

      public void checkRowSpan()
      check rowspan when creator received tag td, th or tr.
    • endDocument

      public void endDocument()
      The Override Method.
      Specified by:
      endDocument in interface IHTMLHandler
      See Also:
    • 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.
    • 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.