Class ODFCreator
java.lang.Object
com.nomagic.magicreport.format.html.AbstractDocumentCreator
com.nomagic.magicreport.format.html.ODFCreator
- All Implemented Interfaces:
IHTMLHandler,IDocumentCreator
The class use for create ODF content.
- Since:
- May 21, 2009
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]Calculate table and td widthchangeColorFormat(String color) Change color(3-digits RGB, 6-digits RGB and color name) to RGB format.voidcharacters(char[] data) Receive notification of character data inside a tag.voidcomment(char[] data) Receive notification of comment data.voidConvert the HTML content from reader into ODF document.convert html to ODF.voidReceive notification of end document tag.voidReceive notification of the end of a tag.floatGet paper height.floatReturn a paperWidth.voidputAttributeToStack(AttributeSet attributes) put start tag attributes in to htmlTagStack.voidsetDocumentPage(com.nomagic.magicreport.DocumentPage page) set document page property.voidsetPaperHeight(float h) Set paper height.voidsetPaperWidth(float w) Set paper width.voidsetProperties(Properties properties) Not Implemented.voidsetReduceTableSize(boolean reduce) Set reduce table size.voidstartTag(HTML.Tag tag, AttributeSet attributes) Receive notification of the start of a tag.Methods inherited from class com.nomagic.magicreport.format.html.AbstractDocumentCreator
createImageTool, getFormatter, getStyleByCSSParser, getStyledDocument, setFormatter, setStyledDocument
-
Constructor Details
-
ODFCreator
public ODFCreator()
-
-
Method Details
-
convert
Convert the HTML content from reader into ODF document.- Specified by:
convertin interfaceIDocumentCreator- 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:
commentin interfaceIHTMLHandler- Parameters:
data- An array holding the characters in the comment.
-
startTag
Receive notification of the start of a tag.- Specified by:
startTagin interfaceIHTMLHandler- Parameters:
tag- HTML tagattributes- The attributes attached to the tag. If there are no attributes, it shall be an empty Attributes object.
-
endTag
Receive notification of the end of a tag.- Specified by:
endTagin interfaceIHTMLHandler- Parameters:
tag- HTML tag
-
characters
public void characters(char[] data) Receive notification of character data inside a tag.- Specified by:
charactersin interfaceIHTMLHandler- Parameters:
data- The characters.
-
endDocument
public void endDocument()Receive notification of end document tag.- Specified by:
endDocumentin interfaceIHTMLHandler- See Also:
-
putAttributeToStack
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 tagattributes- list of attributescontentStack- content of HTML- Returns:
- ODF format
-
setPaperHeight
public void setPaperHeight(float h) Set paper height.- Specified by:
setPaperHeightin interfaceIDocumentCreator- 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:
setPaperWidthin interfaceIDocumentCreator- 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
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
Not Implemented.- Specified by:
setPropertiesin interfaceIDocumentCreator- Parameters:
properties- the properties
-
setDocumentPage
public void setDocumentPage(com.nomagic.magicreport.DocumentPage page) Description copied from interface:IDocumentCreatorset document page property.- Specified by:
setDocumentPagein interfaceIDocumentCreator- 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
-