Package com.scroogexhtml.xmldom
Class XMLDOMWriter
java.lang.Object
com.scroogexhtml.converter.AbstractWriter
com.scroogexhtml.xmldom.XMLDOMWriter
- All Implemented Interfaces:
BorderPropertiesWriter,CharacterPropertiesWriter,DocumentWriter,FieldWriter,FootnoteWriter,HeaderFooterWriter,PageSetupWriter,ParagraphPropertiesWriter,TableStateWriter,Writer
Writer implementation which uses javax.xml to build a DOM tree.
The converter uses a XMLDOMWriter to store the current RTF state,
character properties and paragraph properties,
and to build a Document.
-
Constructor Summary
ConstructorsConstructorDescriptionXMLDOMWriter(ConversionConfiguration configuration, HtmlHeadConfiguration htmlHeadConfig, TablePropConfiguration tablePropConfig, Charset charset) Initializes an instance of the XMLDOMWriter class with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(char value) Adds a character to the document.voidAdds a string to the document.voidvoidAdds a line break to the document.voidaddPicture(EmbeddedPicture picture) static voidappendAttribute(Element element, Attribute attr, String value) Appends an attribute with the given name and value to the specified element if the attribute does not already contain the value.static voidappendStyleAttribute(Element element, String value) Appends a style attribute with the specified value to the given XML element.voidApplies the paragraph properties to the document.voidApplies the text properties to the current document writer.voidFinish the current field expression.voidFinishes the field instruction.voidFinish the field result.voidvoidfooterStart(int footerType) Retrieve the current field expression.voidEnds the header section.voidheaderStart(int headerType) This method starts writing a header of the specified type.voidEnds the current cell in a nested table.voidEnds a nested table row.voidsetFieldExpression(String value) Sets the field expression for the current field being written.voidsetFontName(String newValue) Sets the font name for the character properties.voidsetListLevel(int value) voidsetListOverrideIndex(int listOverrideIndex) voidsetNumberingLevel(NumberingLevel newValue) voidsetNumberingStyle(boolean value) voidEnds the current cell in a table.voidwriteEof()voidwriteTab()Methods inherited from class com.scroogexhtml.converter.AbstractWriter
addAnchor, calculateCurrentPageWidth, footnoteEnd, footnoteStart, getCharacterProperties, getCharProps, getDefaultFontName, getListHeaderInfo, getParagraphProperties, getParProps, intToChar, isInFootnote, popCharacterProperties, popParagraphProperties, resetCharacterAttributes, resetParagraphAttributes, setAlignment, setBGColor, setBold, setBorderColor, setBorderStyle, setBorderWidth, setDefaultFont, setFirstIndent, setFontCharSet, setFontColor, setFontSize, setHidden, setHLColor, setItalic, setItap, setLanguage, setLeftIndent, setLeftMargin, setNodeCharset, setPaperWidth, setParagraphBackgroundColor, setParagraphBorder, setParagraphInTable, setRightIndent, setRightMargin, setRightToLeftChar, setRightToLeftPar, setSpaceAfter, setSpaceBefore, setStrike, setSubscript, setSubscript, setSuperscript, setSuperscript, setUnderline, writeChar
-
Constructor Details
-
XMLDOMWriter
public XMLDOMWriter(ConversionConfiguration configuration, HtmlHeadConfiguration htmlHeadConfig, TablePropConfiguration tablePropConfig, Charset charset) Initializes an instance of the XMLDOMWriter class with the given parameters.- Parameters:
configuration- The conversion configuration.htmlHeadConfig- The HTML head configuration.tablePropConfig- The table property configuration.charset- The character set.
-
-
Method Details
-
getTableWriter
-
add
public void add(char value) Description copied from interface:DocumentWriterAdds a character to the document.- Parameters:
value- the character to add
-
add
Description copied from interface:DocumentWriterAdds a string to the document.- Parameters:
value- the string to be added to the document
-
addLinebreak
public void addLinebreak()Description copied from interface:DocumentWriterAdds a line break to the document. -
writeTab
public void writeTab() -
applyTextProperties
public void applyTextProperties()Description copied from interface:WriterApplies the text properties to the current document writer. This method should be called after any text property is changed. The properties include font style, color, background color, underline, highlight color, etc. The current document writer is responsible for applying these properties to the document. -
applyParagraphProperties
public void applyParagraphProperties()Description copied from interface:WriterApplies the paragraph properties to the document. -
getCurrentFieldExpression
Description copied from interface:FieldWriterRetrieve the current field expression.- Returns:
- the current field expression as a StringBuilder object
-
finishFldInst
public void finishFldInst()Description copied from interface:FieldWriterFinishes the field instruction.This method is called to indicate that the field instruction has finished processing. It is typically called when leaving the
Destination.DG_FLDINSTdestination in the RTF document. -
finishFldRslt
public void finishFldRslt()Description copied from interface:FieldWriterFinish the field result. -
finishField
public void finishField()Description copied from interface:FieldWriterFinish the current field expression. -
setFieldExpression
Description copied from interface:FieldWriterSets the field expression for the current field being written. The field expression is a string value that represents the type of field and any additional parameters. For example, "HYPERLINK index.html" is a field expression.- Parameters:
value- the field expression to set
-
appendStyleAttribute
Appends a style attribute with the specified value to the given XML element.- Parameters:
element- the XML element to which the style attribute is to be appendedvalue- the value of the style attribute to append
-
appendAttribute
Appends an attribute with the given name and value to the specified element if the attribute does not already contain the value.- Parameters:
element- the element to append the attribute toattr- the attributevalue- the value of the attribute to be appended
-
addPicture
-
setFontName
Description copied from interface:CharacterPropertiesWriterSets the font name for the character properties.- Specified by:
setFontNamein interfaceCharacterPropertiesWriter- Overrides:
setFontNamein classAbstractWriter- Parameters:
newValue- the new font name
-
getResult
-
addAutoFootnoteRef
public void addAutoFootnoteRef() -
tableCellEnds
public void tableCellEnds()Description copied from interface:TableStateWriterEnds the current cell in a table.This method is used to mark the end of the current cell when writing tables.
-
setNumberingStyle
public void setNumberingStyle(boolean value) -
setNumberingLevel
-
setListLevel
public void setListLevel(int value) -
setListOverrideIndex
public void setListOverrideIndex(int listOverrideIndex) -
writeEof
public void writeEof() -
headerStart
public void headerStart(int headerType) Description copied from interface:HeaderFooterWriterThis method starts writing a header of the specified type.- Parameters:
headerType- the type of the header
-
nestedTableRowEnds
public void nestedTableRowEnds()Description copied from interface:TableStateWriterEnds a nested table row.This method is used to mark the end of a nested table row when writing tables.
- See Also:
-
nestedTableCellEnds
public void nestedTableCellEnds()Description copied from interface:TableStateWriterEnds the current cell in a nested table. -
headerEnd
public void headerEnd()Description copied from interface:HeaderFooterWriterEnds the header section.
-