source: trunk/docx4j/src/main/java/org/docx4j/model/README.txt @ 757

Revision 757, 2.2 KB checked in by jharrop, 3 years ago (diff)

New class PropertyResolver?, which works out the actual properties which apply to a paragraph or a run.
Use it in HtmlExporterNG, so we can use CSS in conjunction with @class and @style.
Introduced into PDF viaXSLFO.

Line 
1docx4j has a three layered model of a docx file.
2
3The lowest level is org.docx4j.openpackaging, which represents the docx package,
4and each of its constituent parts.
5
6Parts are generally subclasses of org.docx4j.openpackaging.parts.JaxbXmlPart
7
8A JaxbXmlPart has a content tree:
9
10        public Object getJaxbElement() {
11                return jaxbElement;
12        }
13
14        public void setJaxbElement(Object jaxbElement) {
15                this.jaxbElement = jaxbElement;
16        }
17
18The jaxb content tree is the second level of the three layered model.
19
20Most parts (including MainDocumentPart, styles, headers/footers, comments, endnotes/footnotes)
21use org.docx4j.wml (WordprocessingML); wml references org.docx4j.dml (DrawingML) as necessary.
22
23The properties parts use org.docx4j.docProps.
24
25The highest level layer is this package (ie org.docx4j.model).
26This package builds on the lower two layers and does/should include functionality relating to:
27
28- headers/footers
29- list numbering
30- images (TODO: refactor)
31
32Often the question is whether to put functionality into this package or into one of the
33other two layers.
34
35Placing it in the jaxb layer (ie in org.docx4j.wml, org.docx4j.dml, or org.docx4j.docProps)
36is to be avoided, since these classes are (largely) generated automatically from the
37schemas.
38
39You can place the functionality in a particular part (ie in org.docx4j.openpackaging.parts.WordprocessingML)
40if the functionality relates specifically to that part.  So for example, the list numbering stuff could
41have gone into the ListNumberingPart (and probably would have, but for the fact that it comprises
42several different classes).
43
44However, functionality which applies to several parts (eg the header/footer stuff), is clearly better
45placed here.
46
47In general, classes in the highest level will hold references to objects in the lower 2 levels, but
48not vice versa. (Although since there is no central/core object on the highest level, it may be
49convenient to store references to some of these in the package or MainDocumentPart).
50
51Aside: typically, when working with docx4j, you use the lowest level to create/open/save a package,
52to add/remove parts, and to access the jaxb content tree for a particular part.  You use the second and highest levels
53to manipulate the document content.
54
55
56
57
58 
Note: See TracBrowser for help on using the repository browser.