Package org.odftoolkit.odfdom.dom.element.table

Examples of org.odftoolkit.odfdom.dom.element.table.TableTableCellElement


  private TableTableRowElement createDefaultRow(int columnCount, boolean createRepeatedCell) {
    OdfFileDom dom = (OdfFileDom) mTableElement.getOwnerDocument();
    TableTableRowElement aRow = (TableTableRowElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
        OdfDocumentNamespace.TABLE, "table-row"));
    if (createRepeatedCell) {
      TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
          OdfDocumentNamespace.TABLE, "table-cell"));
      if (columnCount > 1) {
        aCell.setTableNumberColumnsRepeatedAttribute(columnCount);
      }
      if (!mIsSpreadsheet) {
        OdfOfficeAutomaticStyles automaticStyles = mTableElement.getAutomaticStyles();
        OdfStyle borderStyle = automaticStyles.newStyle(OdfStyleFamily.TableCell);
        setRightTopBorderStyleProperties(borderStyle);
        aCell.setStyleName(borderStyle.getStyleNameAttribute());
      }
    } else {
      OdfStyle lefttopStyle = null, righttopStyle = null;
      // create 2 kinds of styles
      if (!mIsSpreadsheet) {
        OdfOfficeAutomaticStyles automaticStyles = mTableElement.getAutomaticStyles();
        lefttopStyle = automaticStyles.newStyle(OdfStyleFamily.TableCell);
        setLeftTopBorderStyleProperties(lefttopStyle);
        righttopStyle = automaticStyles.newStyle(OdfStyleFamily.TableCell);
        setRightTopBorderStyleProperties(righttopStyle);
      }
      for (int j = 0; j < columnCount; j++) {
        TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
            OdfDocumentNamespace.TABLE, "table-cell"));
        if (!mIsSpreadsheet) {
          if (j + 1 == columnCount) {
            aCell.setStyleName(righttopStyle.getStyleNameAttribute());
          } else {
            aCell.setStyleName(lefttopStyle.getStyleNameAttribute());
          }
        }
        aRow.appendChild(aCell);
      }
    }
View Full Code Here


                j += coverCellEle.getTableNumberColumnsRepeatedAttribute();
              }
            }
            // find the cover cell, now start cell clone.
            if (coverCellEle instanceof TableTableCellElement) {
              TableTableCellElement newCellEle = (TableTableCellElement) (coverCellEle.cloneNode(true));
              cleanCell(newCellEle);
              newCellEle.removeAttributeNS(tableNameSpace, "number-rows-spanned");
              newRow.appendChild(newCellEle);
              // deal with the following covered cell, spread
              // sheet need change these covered cell to cell.
              if (mIsSpreadsheet) {
                // update column repeated number.
                int columnsSpannedNumber = newCellEle.getTableNumberColumnsSpannedAttribute();
                newCellEle.removeAttributeNS(tableNameSpace, "number-columns-spanned");
                int newColumnRepeatedNumber = newCellEle.getTableNumberColumnsRepeatedAttribute()
                    * columnsSpannedNumber;
                if (newColumnRepeatedNumber > 1) {
                  newCellEle.setTableNumberColumnsRepeatedAttribute(newColumnRepeatedNumber);
                } else {
                  newCellEle.removeAttributeNS(tableNameSpace, "number-columns-repeated");
                }
                // ignore the following covered cell of
                // reference row.
                // added by Daisy because of a bug in demo4
                // cellElement is a covered cell. coverCellEle
                // is its cover cell.
                // below codes will count
                // newColumnRepeatedNumber covered cell.
                int tempi = newColumnRepeatedNumber;
                while (tempi > 0) {
                  int iColumnRepeatedNumber = cellElement.getTableNumberColumnsRepeatedAttribute();
                  if (iColumnRepeatedNumber > tempi) {
                    // split covered cell
                    if (cellElement instanceof TableCoveredTableCellElement) {
                      cellElement.setTableNumberColumnsRepeatedAttribute(iColumnRepeatedNumber
                          - tempi);
                      TableTableCellElementBase newCoveredCellEle = (TableTableCellElementBase) cellElement
                          .cloneNode(true);
                      cleanCell(newCoveredCellEle);
                      if (tempi > 1) {
                        newCoveredCellEle.setTableNumberColumnsRepeatedAttribute(tempi);
                      } else {
                        newCoveredCellEle.removeAttributeNS(
                            OdfDocumentNamespace.TABLE.getUri(), "number-columns-repeated");
                      }
                      refRowElement.insertBefore(newCoveredCellEle, cellElement);
                      cellElement = newCoveredCellEle;
                    }
                  }
                  tempi = tempi - cellElement.getTableNumberColumnsRepeatedAttribute();
                  i = i + cellElement.getTableNumberColumnsRepeatedAttribute();
                  if (!(cellElement instanceof TableCoveredTableCellElement) && (tempi > 0)){
                    Logger.getLogger(Table.class.getName()).log(Level.FINE,  "Not covered cell was ignored");
                  }
                  cellElement = (TableTableCellElementBase) (cellElement.getNextSibling());
                  // while ((cellElement != null) &&
                  // (cellElement instanceof
                  // TableCoveredTableCellElement)) {
                  // cellElement = (TableTableCellElementBase)
                  // (cellElement.getNextSibling());
                  // }
                }
                // i += newColumnRepeatedNumber;
              } else {
                // clone the following covered cell of reference
                // row.
                // added by Daisy because of a bug in demo4
                cellElement = (TableTableCellElementBase) cellElement.getNextSibling();
                i += cellElement.getTableNumberColumnsRepeatedAttribute();
                int newColumnSpanNumber = newCellEle.getTableNumberColumnsSpannedAttribute();
                while ((cellElement != null) && (cellElement instanceof TableCoveredTableCellElement)
                    && (newColumnSpanNumber > 1)) {
                  TableCoveredTableCellElement newCoveredCellElement = (TableCoveredTableCellElement) cellElement
                      .cloneNode(true);
                  cleanCell(newCoveredCellElement);
                  newRow.appendChild(newCoveredCellElement);
                  i += cellElement.getTableNumberColumnsRepeatedAttribute();
                  cellElement = (TableTableCellElementBase) cellElement.getNextSibling();
                  newColumnSpanNumber--;
                }
              }
              break;
            }
            // continue find cover cell
            Node preNode = aRowEle.getPreviousSibling();
            if (preNode instanceof TableTableRowElement) {
              aRowEle = (TableTableRowElement) preNode;
            } else {
              // </table:table-header-rows>
              aRowEle = (TableTableRowElement) (preNode.getLastChild());
            }
          }
        } else {
          TableTableCellElement newCellEle = (TableTableCellElement) cellElement.cloneNode(true);
          cleanCell(newCellEle);
          newRow.appendChild(newCellEle);
          Integer tableNumberColumnsRepeated = newCellEle.getTableNumberColumnsRepeatedAttribute();
          Integer tableNumberColumnsSpanned = newCellEle.getTableNumberColumnsSpannedAttribute();
          i += tableNumberColumnsRepeated * tableNumberColumnsSpanned;
          cellElement = (TableTableCellElementBase) cellElement.getNextSibling();
          if (tableNumberColumnsSpanned > 1) {
            int j = 1;
            if (mIsSpreadsheet) {
              newCellEle.removeAttributeNS(tableNameSpace, "number-columns-spanned");
              int newColumnRepeatedNumber = tableNumberColumnsRepeated * tableNumberColumnsSpanned;
              if (newColumnRepeatedNumber > 1) {
                newCellEle.setTableNumberColumnsRepeatedAttribute(newColumnRepeatedNumber);
              } else {
                newCellEle.removeAttributeNS(tableNameSpace, "number-columns-repeated");
              }
              // cellElement is not a covered cell.
              // below codes will count
              // (newColumnRepeatedNumber-1) covered cell.
              int tempi = newColumnRepeatedNumber;
View Full Code Here

    OdfTableCell nextCell = getCellByIndex(index);
    if (nextCell == null) {
      nextCell = getCellByIndex(getCellCount() - 1);
    }
    for (int i = index + count; i > index; i--) {
      TableTableCellElement newCell = (TableTableCellElement) OdfXMLFactory.newOdfElement((OdfFileDom) maRowElement.getOwnerDocument() ,
          OdfName.newName(OdfDocumentNamespace.TABLE, "table-cell"));
      newCell.setTableStyleNameAttribute(preCell.getStyleName());
      maRowElement.insertBefore(newCell, nextCell.getOdfElement());
    }
  }
View Full Code Here

    splitRepeatedRows();
    OdfTable ownerTable = getTable();

    if (positionCell == null) {
      if (refCell.isCoveredElement()) {
        TableTableCellElement coverCellEle = (TableTableCellElement) refCell.getCoverCell().getOdfElement();
        TableTableCellElement newCellEle = (TableTableCellElement) coverCellEle.cloneNode(true);
        cleanCell(newCellEle);
        insertCellElementBefore(getOdfElement(), null, newCellEle, count);
      } else {
        TableTableCellElement endCellEle = (TableTableCellElement) refCell.getOdfElement().cloneNode(true);
        cleanCell(endCellEle);
        getOdfElement().appendChild(endCellEle);
        reviseStyleFromLastColumnToMedium(refCell);
        if (count > 1) {
          TableTableCellElement newCellEle = (TableTableCellElement) refCell.getOdfElement().cloneNode(true);
          cleanCell(newCellEle);
          insertCellElementBefore(getOdfElement(), endCellEle, newCellEle, count - 1);
        }
      }
    } else {
      TableTableCellElement coverRefCellEle = null;
      TableTableCellElement coverPosCellEle = null;
      OdfTableCell coverRefCell = null;
      if (refCell.isCoveredElement()) { //get ref cover cell
        coverRefCell = refCell.getCoverCell();
        coverRefCellEle = (TableTableCellElement) coverRefCell.getOdfElement();
      }
      if (positionCell.isCoveredElement()) //get position cover cell
      {
        coverPosCellEle = (TableTableCellElement) positionCell.getCoverCell().getOdfElement();
      }

      if ((coverRefCellEle != null && coverRefCellEle == coverPosCellEle) //is cover cell and have the same cover cell
          || (coverPosCellEle != null && refCell.getOdfElement() == coverPosCellEle)) //position cell is cover cell and refer cell covers position cell
      {
        if (coverRefCellEle == null) {
          coverRefCellEle = (TableTableCellElement) refCell.getOdfElement();
          coverRefCell = refCell;
        }
        TableCoveredTableCellElement newCellEle = (TableCoveredTableCellElement) OdfXMLFactory.newOdfElement(
            (OdfFileDom) ownerTable.getOdfElement().getOwnerDocument(),
            OdfName.newName(OdfDocumentNamespace.TABLE, "covered-table-cell"));
        insertCellElementBefore(getOdfElement(), positionCell.getOdfElement(), newCellEle, count);
        if (refCell.getRowIndex() == coverRefCell.getRowIndex()) //the first cover line
        {
          coverRefCell.setColumnSpannedNumber(coverRefCell.getColumnSpannedNumber() + count);
        }
      } else if (coverRefCellEle != null) //is cover cell
      {
        if (refCell.getRowIndex() == coverRefCell.getRowIndex()) { //the first cover line
          TableTableCellElement newCellEle = (TableTableCellElement) coverRefCellEle.cloneNode(true);
          cleanCell(newCellEle);
          insertCellElementBefore(getOdfElement(), positionCell.getOdfElement(), newCellEle, count);
        } else { //the second and other cover line
          TableCoveredTableCellElement newCellEle = (TableCoveredTableCellElement) refCell.getOdfElement().cloneNode(true);
          newCellEle.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "number-columns-repeated");
          insertCellElementBefore(getOdfElement(), positionCell.getOdfElement(), newCellEle, count);
        }
      } else if ((refCell.getOdfElement() == positionCell.getOdfElement())
          && (refCell.getColumnsRepeatedNumber() > 1)) //repeated number
      {
        int repeatNum = refCell.getColumnsRepeatedNumber();
        //update the cell that after the ref cell
        for (int i = repeatNum - 1; i > refCell.mnRepeatedColIndex; i--) {
          ownerTable.updateCellRepository(refCell.getOdfElement(), i, refCell.mnRepeatedRowIndex,
              refCell.getOdfElement(), i + count, refCell.mnRepeatedRowIndex);
        }
        refCell.getOdfElement().setTableNumberColumnsRepeatedAttribute(repeatNum + count);
      } else {
        TableTableCellElement newCellEle = (TableTableCellElement) refCell.getOdfElement().cloneNode(true);
        cleanCell(newCellEle);
        insertCellElementBefore(getOdfElement(), positionCell.getOdfElement(), newCellEle, count);
      }
    }
  }
View Full Code Here

    OdfTableCell newCell = null;
    OdfTable ownerTable = getTable();

    if (positionCell == null) {
      if (refCell.isCoveredElement()) {
        TableTableCellElement coverCellEle = (TableTableCellElement) refCell.getCoverCell().getOdfElement();
        TableTableCellElement newCellEle = (TableTableCellElement) coverCellEle.cloneNode(true);
        cleanCell(newCellEle);
        getOdfElement().appendChild(newCellEle);
        newCell = ownerTable.getCellInstance(newCellEle, 0, 0);
      } else {
        TableTableCellElement newCellEle = (TableTableCellElement) refCell.getOdfElement().cloneNode(true);
        cleanCell(newCellEle);
        getOdfElement().appendChild(newCellEle);
        newCell = ownerTable.getCellInstance(newCellEle, 0, 0);
        reviseStyleFromLastColumnToMedium(refCell);
      }
    } else {
      TableTableCellElement coverRefCellEle = null;
      TableTableCellElement coverPosCellEle = null;
      OdfTableCell coverRefCell = null;
      if (refCell.isCoveredElement()) { //get ref cover cell
        coverRefCell = refCell.getCoverCell();
        coverRefCellEle = (TableTableCellElement) coverRefCell.getOdfElement();
      }
      if (positionCell.isCoveredElement()) //get position cover cell
      {
        coverPosCellEle = (TableTableCellElement) positionCell.getCoverCell().getOdfElement();
      }

      if ((coverRefCellEle != null && coverRefCellEle == coverPosCellEle) //is cover cell and have the same cover cell
          || (coverPosCellEle != null && refCell.getOdfElement() == coverPosCellEle)) //position cell is cover cell and refer cell covers position cell
      {
        if (coverRefCellEle == null) {
          coverRefCellEle = (TableTableCellElement) refCell.getOdfElement();
          coverRefCell = refCell;
        }
        TableCoveredTableCellElement newCellEle = (TableCoveredTableCellElement) OdfXMLFactory.newOdfElement(
            (OdfFileDom) ownerTable.getOdfElement().getOwnerDocument(),
            OdfName.newName(OdfDocumentNamespace.TABLE, "covered-table-cell"));
        getOdfElement().insertBefore(newCellEle, positionCell.getOdfElement());
        if (refCell.getRowIndex() == coverRefCell.getRowIndex()) //the first cover line
        {
          coverRefCell.setColumnSpannedNumber(coverRefCell.getColumnSpannedNumber() + 1);
        }
        newCell = ownerTable.getCellInstance(newCellEle, 0, 0);
      } else if (coverRefCellEle != null) //is cover cell
      {
        if (refCell.getRowIndex() == coverRefCell.getRowIndex()) { //the first cover line
          TableTableCellElement newCellEle = (TableTableCellElement) coverRefCellEle.cloneNode(true);
          cleanCell(newCellEle);
          getOdfElement().insertBefore(newCellEle, positionCell.getOdfElement());
          newCell = ownerTable.getCellInstance(newCellEle, 0, 0);
        } else { //the second and other cover line
          TableCoveredTableCellElement newCellEle = (TableCoveredTableCellElement) refCell.getOdfElement().cloneNode(true);
          newCellEle.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "number-columns-repeated");
          getOdfElement().insertBefore(newCellEle, positionCell.getOdfElement());
          newCell = ownerTable.getCellInstance(newCellEle, 0, 0);
        }
      } else if ((refCell.getOdfElement() == positionCell.getOdfElement())
          && (refCell.getColumnsRepeatedNumber() > 1)) //repeated number
      {
        int repeatNum = refCell.getColumnsRepeatedNumber();
        //update the cell that after the ref cell
        for (int i = repeatNum - 1; i > refCell.mnRepeatedColIndex; i--) {
          ownerTable.updateCellRepository(refCell.getOdfElement(), i, refCell.mnRepeatedRowIndex,
              refCell.getOdfElement(), i + 1, refCell.mnRepeatedRowIndex);
        }
        refCell.getOdfElement().setTableNumberColumnsRepeatedAttribute(repeatNum + 1);
        newCell = ownerTable.getCellInstance(refCell.getOdfElement(), refCell.mnRepeatedColIndex + 1, refCell.mnRepeatedRowIndex);
      } else {
        TableTableCellElement newCellEle = (TableTableCellElement) refCell.getOdfElement().cloneNode(true);
        cleanCell(newCellEle);
        getOdfElement().insertBefore(newCellEle, positionCell.getOdfElement());
        newCell = ownerTable.getCellInstance(newCellEle, 0, 0);
      }
    }
View Full Code Here

    for (int i = 0; i < columnCount;) {
      Cell refCell = refRow.getCellByIndex(i);
      int columnsRepeatedNumber = refCell.getColumnsRepeatedNumber();
      if (!refCell.isCoveredElement()) // not cover element
      {
        TableTableCellElement aCellEle = (TableTableCellElement) refCell.getOdfElement();
        coveredHeigth = aCellEle.getTableNumberRowsSpannedAttribute();
        if (coveredHeigth == 1) {
          TableTableCellElement newCellEle = (TableTableCellElement) aCellEle.cloneNode(true);
          cleanCell(newCellEle);
          aRow.appendChild(newCellEle);
        } else { // cover more rows
          aCellEle.setTableNumberRowsSpannedAttribute(coveredHeigth + 1);
          TableCoveredTableCellElement newCellEle = (TableCoveredTableCellElement) OdfXMLFactory
              .newOdfElement((OdfFileDom) mTableElement.getOwnerDocument(), OdfName.newName(
                  OdfDocumentNamespace.TABLE, "covered-table-cell"));
          if (columnsRepeatedNumber > 1) {
            newCellEle.setTableNumberColumnsRepeatedAttribute(columnsRepeatedNumber);
          } else {
            newCellEle.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "number-columns-repeated");
          }
          aRow.appendChild(newCellEle);
        }

        coveredLength = aCellEle.getTableNumberColumnsSpannedAttribute() - columnsRepeatedNumber;
        i = i + columnsRepeatedNumber;
      } else {
        TableCoveredTableCellElement aCellEle = (TableCoveredTableCellElement) refCell.getOdfElement();
        if (coveredLength >= 1) {
          TableCoveredTableCellElement newCellEle = (TableCoveredTableCellElement) aCellEle.cloneNode(true);
          aRow.appendChild(newCellEle);
          coveredLength -= newCellEle.getTableNumberColumnsRepeatedAttribute();
        } else {
          TableTableCellElement coveredCell = (TableTableCellElement) refCell.getCoverCell().getOdfElement();
          TableTableCellElement newCellEle = (TableTableCellElement) coveredCell.cloneNode(true);
          cleanCell(newCellEle);
          newCellEle.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "number-rows-spanned");
          aRow.appendChild(newCellEle);
          coveredLength = coveredCell.getTableNumberColumnsSpannedAttribute() - columnsRepeatedNumber;
        }
        i = i + columnsRepeatedNumber;
      }
View Full Code Here

            coveredCell.splitRepeatedCells();
            coveredCell = table.getCellByPosition(cell.getColumnIndex(), getRowIndex() + 1);
          }

          //create a new cell
          TableTableCellElement newCellEle = (TableTableCellElement) cell.getOdfElement().cloneNode(true);
          newCellEle.setTableNumberRowsSpannedAttribute(cell.getRowSpannedNumber() - getRowsRepeatedNumber());
          //update repository
          int startRow = coveredCell.getRowIndex();
          int endRow = coveredCell.getRowIndex() + newCellEle.getTableNumberRowsSpannedAttribute();
          int startClm = coveredCell.getColumnIndex();
          int endClm = coveredCell.getColumnIndex() + newCellEle.getTableNumberColumnsSpannedAttribute() * newCellEle.getTableNumberColumnsRepeatedAttribute();
          coveredCell.getOdfElement().getParentNode().replaceChild(newCellEle, coveredCell.getOdfElement());

          table.updateRepositoryWhenCellElementChanged(startRow, endRow, startClm, endClm, newCellEle);
        }
      }
View Full Code Here

  private void updateTableCells(OdfDocument odfdoc, String tablename,
      double[] values, String[] labels) {
    int i = 0, j = 0;
    TableTableRowElement td;
    TableTableCellElement cell;
    OdfFileDom dom;
    NodeList tableList;
    TableTableElement myTable;
    NodeList lst;
    OdfTextParagraph p;
    OfficeSpreadsheetElement spreadsheet = null;

    try {
      dom = odfdoc.getContentDom();
      tableList = dom.getElementsByTagNameNS(
          OdfDocumentNamespace.TABLE.getUri(), "table");
      spreadsheet = (OfficeSpreadsheetElement) dom.getElementsByTagNameNS(
          OdfDocumentNamespace.OFFICE.getUri(), "spreadsheet").item(0);

      i = 0;
      if (tableList.getLength() > 0) {
        for (; i < tableList.getLength(); i++) {
          String currentname = ((TableTableElement) tableList.item(i)).getTableNameAttribute();
          if (currentname == null) {
            currentname = "";
          }
          if (currentname.equalsIgnoreCase(tablename)) {
            break;
          }
        }
      }
      if (i < tableList.getLength()) //table with the specific table name is found
      {
        myTable = (TableTableElement) tableList.item(i);
      } else { //table with the specific table name is not found. Create table
        myTable = dom.newOdfElement(TableTableElement.class);
        myTable.setTableNameAttribute(tablename);
        spreadsheet.appendChild(myTable);
      }

      lst = myTable.getElementsByTagNameNS(OdfDocumentNamespace.TABLE.getUri(), "table-row");
      if (lst.getLength() == 0) { //the first table row is not existed. Create table row
        td = dom.newOdfElement(TableTableRowElement.class);
        cell = dom.newOdfElement(TableTableCellElement.class);
        p = dom.newOdfElement(OdfTextParagraph.class);
        if (tablename.startsWith("Memory")) {
          p.setTextContent("memory(b)");
        } else {
          p.setTextContent("time(ms)");
        }
        td.appendChild(cell);
        cell.appendChild(p);
        myTable.appendChild(td);
      } else {
        td = (TableTableRowElement) lst.item(0); //the first table row is existed.
      }
      cell = dom.newOdfElement(TableTableCellElement.class);
      td.appendChild(cell);
      p = dom.newOdfElement(OdfTextParagraph.class);
      p.setTextContent(testTag);
      cell.appendChild(p);


      for (i = 1; i < values.length + 1; i++) {
        if (i < lst.getLength()) { //table row is existed
          td = (TableTableRowElement) lst.item(i);
        } else { //table row is not existed.
          td = dom.newOdfElement(TableTableRowElement.class);
          myTable.appendChild(td);
          //append first cell with labels
          cell = dom.newOdfElement(TableTableCellElement.class);
          td.appendChild(cell);
          p = dom.newOdfElement(OdfTextParagraph.class);
          p.setTextContent(labels[j]);
          cell.appendChild(p);
        }
        cell = dom.newOdfElement(TableTableCellElement.class);
        cell.setOfficeValueTypeAttribute("float");
        cell.setOfficeValueAttribute(new Double(values[j]));
        p = dom.newOdfElement(OdfTextParagraph.class);
        p.setTextContent(values[j] + "");
        cell.appendChild(p);
        td.appendChild(cell);
        j++;
      }
    } catch (Exception e) {
      LOG.log(Level.SEVERE, null, e);
View Full Code Here

    try {
      OdfContentDom contentDom = this.getContentDom();
      OdfDrawFrame drawFrame = contentDom.newOdfElement(OdfDrawFrame.class);
      XPath xpath = contentDom.getXPath();
      if (this instanceof OdfSpreadsheetDocument) {
        TableTableCellElement lastCell = (TableTableCellElement) xpath.evaluate("//table:table-cell[last()]", contentDom, XPathConstants.NODE);
        lastCell.appendChild(drawFrame);
        drawFrame.removeAttribute("text:anchor-type");

      } else if (this instanceof OdfTextDocument) {
        TextPElement lastPara = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
        if (lastPara == null) {
View Full Code Here

      OdfDocument odfdoc = OdfDocument.loadDocument(ResourceUtilities.getAbsolutePath("table.odt"));
      NodeList lst = odfdoc.getContentDom().getElementsByTagNameNS(OdfDocumentNamespace.TABLE.getUri(), "table-cell");
      for (int i = 0; i < lst.getLength(); i++) {
        Node node = lst.item(i);
        Assert.assertTrue(node instanceof TableTableCellElement);
        TableTableCellElement td = (TableTableCellElement) lst.item(i);
        TableTableRowElement tr = (TableTableRowElement) td.getParentNode();
        Assert.assertNotNull(tr);

        OdfTable table = OdfTableRow.getInstance(tr).getTable();
        Assert.assertNotNull(table);
        Assert.assertTrue(table == OdfTableCell.getInstance(td).getTable());
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.table.TableTableCellElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.