Class AbstractTableWriterModel
java.lang.Object
org.docx4j.model.table.TableModel
org.docx4j.convert.out.common.writer.AbstractTableWriterModel
There are different ways to represent a table with possibly merged
cells.
- In html, both vertically and horizontally merged cells are represented by one cell only that has a colspan and rowspan attribute. No dummy cells are used.
- In docx, horizontally merged cells are represented by one cell with a gridSpan attribute; while vertically merged cells are represented as a top cell containing the actual content and a series of dummy cells having a vMerge tag with "continue" attribute.
- This table is a regular matrix, dummy cells are added for both merge directions.
- When a cell is added, its colspan is set. Even a dummy cell can have a colspan, the same value as its upper has.
- When a new cell has a colspan greater than 1, the required extra dummy cells are also added
- When a docx dummy cell is encountered (one with a vMerge continue attribute), the rowspan is incremented in its upper neighbors until a real cell is found.
- Author:
- Adam Schmideg, Alberto Zerolo, Jason Harrop
-
Nested Class Summary
Nested classes/interfaces inherited from class org.docx4j.model.table.TableModel
TableModel.TrFinder -
Field Summary
Fields inherited from class org.docx4j.model.table.TableModel
col, drawTableBorder, effectiveTableStyle, headerMaxRow, row, rows, styleId, tbl, tblGrid, tblPr, width -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new cell to this table and copy processed content of tc to it.protected voidvoidbuild(AbstractWmlConversionContext conversionContext, Object node, Node content) Build a table representation from a tbl instance.protected voidMethods inherited from class org.docx4j.model.table.TableModel
addCell, addCell, addDummyCell, build, calcTableWidth, debugStr, getCell, getColCount, getColName, getEffectiveTableStyle, getElement, getGridAfter, getGridBefore, getHeaderMaxRow, getRows, getStyleId, getTableWidth, getTblGrid, getTblPr, handleRow, isBorderConflictResolutionRequired, isDrawTableBorders, isHeaderRow, resetIndexes, setBorderConflictResolutionRequired, startRow
-
Constructor Details
-
AbstractTableWriterModel
public AbstractTableWriterModel()
-
-
Method Details
-
addCell
Add a new cell to this table and copy processed content of tc to it. -
addRow
-
build
public void build(AbstractWmlConversionContext conversionContext, Object node, Node content) throws TransformerException Build a table representation from a tbl instance. Remember to set wordMLPackage before using this method!- Throws:
TransformerException
-
handleRow
-