Package org.odftoolkit.odfdom.dom.element.office

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeBodyElement


   *             if the file DOM could not be created.
   */
  @SuppressWarnings("unchecked")
  protected <T extends OdfElement> T getContentRoot(Class<T> clazz) throws Exception {
    OdfElement contentRoot = getContentDom().getRootElement();
    OfficeBodyElement contentBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, contentRoot);
    NodeList childs = contentBody.getChildNodes();
    for (int i = 0; i < childs.getLength(); i++) {
      Node cur = childs.item(i);
      if ((cur != null) && clazz.isInstance(cur)) {
        return (T) cur;
      }
View Full Code Here


    TextSectionElement element;
    ArrayList<Section> list = new ArrayList<Section>();
    try {
      // search in content.xml
      OdfElement root = getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      NodeList sectionList = officeBody.getElementsByTagNameNS(OdfDocumentNamespace.TEXT.getUri(), "section");
      for (int i = 0; i < sectionList.getLength(); i++) {
        element = (TextSectionElement) sectionList.item(i);
        list.add(Section.getInstance(element));
      }
View Full Code Here

   */
  public Section getSectionByName(String name) {
    TextSectionElement element;
    try {
      OdfElement root = getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      XPath xpath = getContentDom().getXPath();
      String xpathValue = ".//text:section[@text:name=\"" + name + "\"]";
      element = (TextSectionElement) xpath.evaluate(xpathValue, officeBody, XPathConstants.NODE);
      if (element != null) {
        return Section.getInstance(element);
View Full Code Here

  // ToDo: Instead of a method to receive all possible feature/components on the document, there might be a generic or one each element?
  public List<TableTableElement> getTables() {
    List<TableTableElement> tableList = new ArrayList<TableTableElement>();
    try {
      // find tables from content.xml
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, getContentDom().getRootElement());
      OdfElement contentRoot = OdfElement.findFirstChildNode(OdfElement.class, officeBody);
      tableList = fillTableList(contentRoot, tableList);
     
      // find tables from styles.xml (header & footer)
      Map<String, StyleMasterPageElement> masterPages = getMasterPages();
View Full Code Here

    try {
      TableTableElement newTEle = createTable(document, DEFAULT_ROW_COUNT, DEFAULT_COLUMN_COUNT, 0, 0);

      //4. append to the end of document
      OdfElement root = document.getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);
      typedContent.appendChild(newTEle);

      return OdfTable.getInstance(newTEle);
View Full Code Here

    try {
      TableTableElement newTEle = createTable(document, numRows, numCols, 0, 0);

      //4. append to the end of document
      OdfElement root = document.getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);
      typedContent.appendChild(newTEle);

      return OdfTable.getInstance(newTEle);
   
View Full Code Here

    try {
      TableTableElement newTEle = createTable(document, numRows, numCols, headerRowNumber, headerColumnNumber);

      //4. append to the end of document
      OdfElement root = document.getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);
      typedContent.appendChild(newTEle);

      return OdfTable.getInstance(newTEle);
View Full Code Here

    try {
      TableTableElement newTEle = createTable(document, rowNumber + rowHeaders, columnNumber + columnHeaders, rowHeaders, columnHeaders);

      //4. append to the end of document
      OdfElement root = document.getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);
      typedContent.appendChild(newTEle);

      OdfTable table = OdfTable.getInstance(newTEle);
      List<OdfTableRow> rowList = table.getRowList();
View Full Code Here

    try {
      TableTableElement newTEle = createTable(document, rowNumber + rowHeaders, columnNumber + columnHeaders, rowHeaders, columnHeaders);

      //4. append to the end of document
      OdfElement root = document.getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);
      typedContent.appendChild(newTEle);

      OdfTable table = OdfTable.getInstance(newTEle);
      List<OdfTableRow> rowList = table.getRowList();
View Full Code Here

   * @throws Exception if the file DOM could not be created.
   */
  @SuppressWarnings("unchecked")
  <T extends OdfElement> T getContentRoot(Class<T> clazz) throws Exception {
    OdfElement contentRoot = getContentDom().getRootElement();
    OfficeBodyElement contentBody = OdfElement.findFirstChildNode(
        OfficeBodyElement.class, contentRoot);
    NodeList childs = contentBody.getChildNodes();
    for (int i = 0;
        i < childs.getLength();
        i++) {
      Node cur = childs.item(i);
      if ((cur != null) && clazz.isInstance(cur)) {
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.office.OfficeBodyElement

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.