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 TypeMethodDescriptionvoid
add
(char value) Adds a character to the document.void
Adds a string to the document.void
void
Adds a line break to the document.void
addPicture
(EmbeddedPicture picture) static void
appendAttribute
(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 void
appendStyleAttribute
(Element element, String value) Appends a style attribute with the specified value to the given XML element.void
Applies the paragraph properties to the document.void
Applies the text properties to the current document writer.void
Finish the current field expression.void
Finishes the field instruction.void
Finish the field result.void
void
footerStart
(int footerType) Retrieve the current field expression.void
Ends the header section.void
headerStart
(int headerType) This method starts writing a header of the specified type.void
Ends the current cell in a nested table.void
Ends a nested table row.void
setFieldExpression
(String value) Sets the field expression for the current field being written.void
setFontName
(String newValue) Sets the font name for the character properties.void
setListLevel
(int value) void
setListOverrideIndex
(int listOverrideIndex) void
setNumberingLevel
(NumberingLevel newValue) void
setNumberingStyle
(boolean value) void
Ends the current cell in a table.void
writeEof()
void
writeTab()
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:DocumentWriter
Adds a character to the document.- Parameters:
value
- the character to add
-
add
Description copied from interface:DocumentWriter
Adds a string to the document.- Parameters:
value
- the string to be added to the document
-
addLinebreak
public void addLinebreak()Description copied from interface:DocumentWriter
Adds a line break to the document. -
writeTab
public void writeTab() -
applyTextProperties
public void applyTextProperties()Description copied from interface:Writer
Applies 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:Writer
Applies the paragraph properties to the document. -
getCurrentFieldExpression
Description copied from interface:FieldWriter
Retrieve the current field expression.- Returns:
- the current field expression as a StringBuilder object
-
finishFldInst
public void finishFldInst()Description copied from interface:FieldWriter
Finishes 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_FLDINST
destination in the RTF document. -
finishFldRslt
public void finishFldRslt()Description copied from interface:FieldWriter
Finish the field result. -
finishField
public void finishField()Description copied from interface:FieldWriter
Finish the current field expression. -
setFieldExpression
Description copied from interface:FieldWriter
Sets 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:CharacterPropertiesWriter
Sets the font name for the character properties.- Specified by:
setFontName
in interfaceCharacterPropertiesWriter
- Overrides:
setFontName
in classAbstractWriter
- Parameters:
newValue
- the new font name
-
getResult
-
addAutoFootnoteRef
public void addAutoFootnoteRef() -
tableCellEnds
public void tableCellEnds()Description copied from interface:TableStateWriter
Ends 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:HeaderFooterWriter
This method starts writing a header of the specified type.- Parameters:
headerType
- the type of the header
-
nestedTableRowEnds
public void nestedTableRowEnds()Description copied from interface:TableStateWriter
Ends 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:TableStateWriter
Ends the current cell in a nested table. -
headerEnd
public void headerEnd()Description copied from interface:HeaderFooterWriter
Ends the header section.
-