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

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


   * @return an instance of table feature with the specific table name.
   */
  public OdfTable getTableByName(String name) {
    try {
      OdfElement root = getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);

      NodeList childList = typedContent.getChildNodes();
      for (int i = 0; i < childList.getLength(); i++) {
        if (childList.item(i) instanceof TableTableElement) {
View Full Code Here


   */
  public List<OdfTable> getTableList() {
    List<OdfTable> tableList = new ArrayList<OdfTable>();
    try {
      OdfElement root = getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(
          OdfElement.class, officeBody);
      NodeList childList = typedContent.getChildNodes();
      for (int i = 0;
          i < childList.getLength();
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

   *             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

   * @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

   * @return an instance of table feature with the specific table name.
   */
  public OdfTable getTableByName(String name) {
    try {
      OdfElement root = getContentDom().getRootElement();
      OfficeBodyElement officeBody = OdfElement.findFirstChildNode(OfficeBodyElement.class, root);
      OdfElement typedContent = OdfElement.findFirstChildNode(OdfElement.class, officeBody);

      NodeList childList = typedContent.getChildNodes();
      for (int i = 0; i < childList.getLength(); i++) {
        if (childList.item(i) instanceof TableTableElement) {
View Full Code Here

          OdfTextParagraph.ELEMENT_NAME.getLocalName());
      Assert.assertTrue(lst.getLength() > 0);
      OdfTextParagraph p0 = (OdfTextParagraph) lst.item(lst.getLength() - 1);

      OfficeDocumentContentElement content = contentDom.newOdfElement(OfficeDocumentContentElement.class);
      OfficeBodyElement body = contentDom.newOdfElement(OfficeBodyElement.class);
      content.appendChild(body);
      ChartChartElement chart = contentDom.newOdfElement(ChartChartElement.class);
      //create children element
      ChartPlotAreaElement plotArea = chart.newChartPlotAreaElement();
      body.appendChild(chart);
      p0.getParentNode().insertBefore(content, p0);


      XPath xpath = contentDom.getXPath();
      ChartChartElement chartTest = (ChartChartElement) xpath.evaluate("//chart:chart[last()]", contentDom, XPathConstants.NODE);
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.