// first-row-start-column
Cell cell = table.getCellByPosition(0, 0);
cell.getParagraphIterator().hasNext();
cell.getParagraphIterator().next().getStyleName();
Paragraph para = cell.getParagraphByIndex(0, false);
String paraStyle = (para != null ? para.getStyleName() : null);
template.setExtendedStyleByType(
TableTemplate.ExtendedStyleType.FIRSTROWSTARTCOLUM, cell
.getStyleName(), paraStyle);
TableTableCellElementBase oldCellEle = cell.getOdfElement();
TableTableCellElementBase newCellEle = (TableTableCellElementBase) oldCellEle
.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// first-row-end-column
cell = table.getCellByPosition(4, 0);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setExtendedStyleByType(
TableTemplate.ExtendedStyleType.FIRSTROWENDCOLUMN, cell
.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// last-row-start-column
cell = table.getCellByPosition(0, 4);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setExtendedStyleByType(
TableTemplate.ExtendedStyleType.LASTROWSTARTCOLUMN, cell
.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// last-row-end-column
cell = table.getCellByPosition(4, 4);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setExtendedStyleByType(
TableTemplate.ExtendedStyleType.LASTROWENDCOLUMN, cell
.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// first column
cell = table.getCellByPosition(0, 1);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableFirstColumnStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// last column
cell = table.getCellByPosition(4, 2);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableLastColumnStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// first row
cell = table.getCellByPosition(1, 0);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableFirstRowStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// last row
cell = table.getCellByPosition(1, 4);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableLastRowStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// body (=odd row/column)
cell = table.getCellByPosition(1, 1);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableBodyStyle(cell.getStyleName(), paraStyle);
template.setTableOddRowsStyle(cell.getStyleName(), paraStyle);
template.setTableOddColumnsStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// even row
cell = table.getCellByPosition(1, 2);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableEvenRowsStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());
// even row
cell = table.getCellByPosition(2, 1);
para = cell.getParagraphByIndex(0, false);
paraStyle = (para != null ? para.getStyleName() : null);
template.setTableEvenColumnsStyle(cell.getStyleName(), paraStyle);
oldCellEle = cell.getOdfElement();
newCellEle = (TableTableCellElementBase) oldCellEle.cloneNode(true);
copyForeignStyleRef(newCellEle, cell.getOwnerDocument());