Search in sources :

Example 1 with CTTableCell

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell in project poi by apache.

the class XSLFTableCell method prototype.

static CTTableCell prototype() {
    CTTableCell cell = CTTableCell.Factory.newInstance();
    CTTableCellProperties pr = cell.addNewTcPr();
    pr.addNewLnL().addNewNoFill();
    pr.addNewLnR().addNewNoFill();
    pr.addNewLnT().addNewNoFill();
    pr.addNewLnB().addNewNoFill();
    return cell;
}
Also used : CTTableCell(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell) CTTableCellProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties)

Example 2 with CTTableCell

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell in project poi by apache.

the class XSLFTableRow method addCell.

public XSLFTableCell addCell() {
    CTTableCell c = _row.addNewTc();
    c.set(XSLFTableCell.prototype());
    XSLFTableCell cell = new XSLFTableCell(c, _table);
    _cells.add(cell);
    if (_table.getNumberOfColumns() < _row.sizeOfTcArray()) {
        _table.getCTTable().getTblGrid().addNewGridCol().setW(Units.toEMU(100.0));
    }
    _table.updateRowColIndexes();
    return cell;
}
Also used : CTTableCell(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell)

Example 3 with CTTableCell

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell in project poi by apache.

the class XSLFTableCell method getCellProperties.

protected CTTableCellProperties getCellProperties(boolean create) {
    if (_tcPr == null) {
        CTTableCell cell = getCell();
        _tcPr = cell.getTcPr();
        if (_tcPr == null && create) {
            _tcPr = cell.addNewTcPr();
        }
    }
    return _tcPr;
}
Also used : CTTableCell(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell)

Example 4 with CTTableCell

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell in project poi by apache.

the class XSLFTableCell method getTextBody.

@Override
protected CTTextBody getTextBody(boolean create) {
    CTTableCell cell = getCell();
    CTTextBody txBody = cell.getTxBody();
    if (txBody == null && create) {
        txBody = cell.addNewTxBody();
        XSLFAutoShape.initTextBody(txBody);
    }
    return txBody;
}
Also used : CTTableCell(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell) CTTextBody(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)

Example 5 with CTTableCell

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell in project poi by apache.

the class TestXSLFTableRow method addCell.

/** copied from {@link TestXSLFTable#testCreate()} */
@Test
public void addCell() {
    XSLFTableCell cell = row.addCell();
    assertNotNull(cell);
    assertNotNull(cell.getXmlObject());
    // by default table cell has no borders
    CTTableCell tc = (CTTableCell) cell.getXmlObject();
    assertTrue(tc.getTcPr().getLnB().isSetNoFill());
    assertTrue(tc.getTcPr().getLnT().isSetNoFill());
    assertTrue(tc.getTcPr().getLnL().isSetNoFill());
    assertTrue(tc.getTcPr().getLnR().isSetNoFill());
}
Also used : CTTableCell(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell) Test(org.junit.Test)

Aggregations

CTTableCell (org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell)6 Test (org.junit.Test)2 BorderEdge (org.apache.poi.sl.usermodel.TableCell.BorderEdge)1 CTTableCellProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties)1 CTTextBody (org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)1 CTGraphicalObjectFrame (org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame)1