Package org.docx4j.dml.diagram

Examples of org.docx4j.dml.diagram.CTDataModel


//        System.out.println(XmlUtils.unwrap(j).getClass().getName() );
        artificialList.add(j);       
      }
      return artificialList;
    } else if (o instanceof CTDataModel) {
      CTDataModel dataModel = (CTDataModel)o;
      List<Object> artificialList = new ArrayList<Object>();
      // We're going to create a list merging two children ..     
      artificialList.addAll(dataModel.getPtLst().getPt());
      artificialList.addAll(dataModel.getCxnLst().getCxn());     
      return artificialList;
    } else if (o instanceof org.docx4j.dml.diagram2008.CTDrawing) {
      return ((org.docx4j.dml.diagram2008.CTDrawing)o).getSpTree().getSpOrGrpSp();
    } else if (o instanceof org.docx4j.vml.CTTextbox) {       
//      return ((org.docx4j.vml.CTTextbox)o).getAny();     
View Full Code Here


    // Get the sample data from dgm:sampData
    if (gloxPackage.getDiagramLayoutPart().getJaxbElement().getSampData()==null) {
      log.error("Sample data missing!");
      return;
    }
    CTDataModel sampleDataModel = gloxPackage.getDiagramLayoutPart().getJaxbElement().getSampData().getDataModel();

    // If there is none, this sample won't work
    if (sampleDataModel==null
        || sampleDataModel.getPtLst()==null
        || sampleDataModel.getPtLst().getPt().size()==0) {
      System.out.println("No sample data in this glox, so can't create demo docx");
      return;
      // TODO: in this case, try generating our own sample data?
    }

    CTDataModel clonedDataModel = XmlUtils.deepCopy((CTDataModel)sampleDataModel);
    data.setJaxbElement( clonedDataModel );

        /* <dgm:pt modelId="1" type="doc">
            <dgm:prSet
                loTypeId="mylayout"
                qsTypeId="mystyle"
                csTypeId="mycolors" />
        </dgm:pt> */
    CTElemPropSet prSet = factory.createCTElemPropSet();
    prSet.setLoTypeId("mylayout");
    prSet.setQsTypeId(style.getJaxbElement().getUniqueId());
    prSet.setCsTypeId(colors.getJaxbElement().getUniqueId());

    clonedDataModel.getPtLst().getPt().get(0).setPrSet(prSet);

    String layoutRelId = wordMLPackage.getMainDocumentPart().addTargetPart(layout).getId();
    String dataRelId = wordMLPackage.getMainDocumentPart().addTargetPart(data).getId();
    String colorsRelId = wordMLPackage.getMainDocumentPart().addTargetPart(colors).getId();
    String styleRelId = wordMLPackage.getMainDocumentPart().addTargetPart(style).getId();
View Full Code Here

TOP

Related Classes of org.docx4j.dml.diagram.CTDataModel

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.