DocumentBuilder makes the process of building a Document easier.
Document is a composite object consisting of a tree of nodes and while inserting content
nodes directly into the tree is possible, it requires good understanding of the tree structure.
DocumentBuilder is a "facade" for the complex structure of Document and allows
to insert content and formatting quickly and easily.
Create a DocumentBuilder and associate it with a Document.
The DocumentBuilder has an internal cursor where the text will be inserted
when you call write(java.lang.String), writeln(java.lang.String), insertBreak(int)
and other methods. You can navigate the DocumentBuilder cursor to a different location
in a document using various MoveToXXX methods.
Use the Font property to specify character formatting that will apply to
all text inserted from the current position in the document onwards.
Use the ParagraphFormat property to specify paragraph formatting for the current
and all paragraphs that will be inserted.
Use the PageSetup property to specify page and section properties for the current
section and all section that will be inserted.
Use the CellFormat and RowFormat properties to specify
formatting properties for table cells and rows. User the insertCell() and
endRow() methods to build a table.
Note that Font, ParagraphFormat and PageSetup properties are updated whenever
you navigate to a different place in the document to reflect formatting properties available at the new location.