Package org.docx4j.wml

Examples of org.docx4j.wml.SdtPr$Group


    listStack.clear();
  }
 
  private void setTag(SdtBlock sdtList, BigInteger numId, BigInteger ilvl) {
   
    SdtPr sdtPr = new SdtPr();
    Tag tag = new Tag();
    sdtPr.setTag(tag);
   
    sdtList.setSdtPr(sdtPr);
   
    // Bullets = UL.  Work it out.
    ListNumberingDefinition lnd = ndp.getInstanceListDefinitions().get(numId.toString());
View Full Code Here


  private static SdtBlock createSdt(String tagVal, RPr rPr) {
   
    // .. so create content control!
    SdtBlock sdtBlock = Context.getWmlObjectFactory().createSdtBlock();

    SdtPr sdtPr = Context.getWmlObjectFactory().createSdtPr();
    sdtBlock.setSdtPr(sdtPr);

    SdtContentBlock sdtContent = Context.getWmlObjectFactory().createSdtContentBlock();
    sdtBlock.setSdtContent(sdtContent);

    // For borders/shading, we'll use the values in this first paragraph.
    // We'll use a tag, so the XSLT can detect that its supposed to do something special.
    Tag tag = Context.getWmlObjectFactory().createTag();
    tag.setVal(tagVal);
   
    sdtPr.setTag(tag);
    if (rPr != null) {
      sdtPr.getRPrOrAliasOrLock().add((RPr)XmlUtils.deepCopy(rPr));
      /*
       * ECMA-376 says "specifies the set of run properties which shall be applied to
       *  the text entered into the parent structured document tag in replacement of
       *  placeholder text. When placeholder text is present in a structured document
       *  tag, its formatting is often different than the desired underlying formatting,
View Full Code Here

    }
   
    private void handleSdt(Object o) {
     
      SdtElement sdt = (SdtElement)o;
      SdtPr sdtPr = sdt.getSdtPr();
     
      Tag tag = sdtPr.getTag();     
      HashMap<String, String> map = null;
      if (tag!=null) {
        map = QueryString.parseQueryString(
          tag.getVal(), true);
      }     
     
      SdtPr.Picture pic = getPicture(sdtPr);
      if (sdtPr.getDataBinding()!=null && pic!=null) {
       
        Object sdtParent = ((Child)o).getParent();
               
        sdt.getSdtContent().getContent().clear();       
        sdt.getSdtContent().getContent().add(
            this.xpathInjectImage(
                (WordprocessingMLPackage)pkg, part,
                sdtPr.getDataBinding(), sdt,
                sdtParent));
       
        // TODO v3 XSLT approach
        // .. if the sdt contains a template picture,
        // find its a:blip, and just replace that.
       
      } else if (map!=null && map.containsKey(OpenDoPEHandler.BINDING_CONTENTTYPE)
            && map.get(OpenDoPEHandler.BINDING_CONTENTTYPE).equals("application/xhtml+xml")) {
          // Convert XHTML.
        log.error("TODO: add HTML import support");
       
      } else if (map!=null && map.containsKey(OpenDoPEHandler.BINDING_ROLE_CONDITIONAL) ) {
        // Do nothing
      } else if (map!=null && map.containsKey(OpenDoPEHandler.BINDING_RESULT_RPTD) ) {
        // Do nothing
       
      } else if (map!=null && map.containsKey(OpenDoPEHandler.BINDING_ROLE_RPT_POS_CON) ) {
        // This may be tricky to do here ..
       
      } else if (map!=null && map.containsKey(OpenDoPEHandler.BINDING_ROLE_XPATH) ) {
       
        boolean isMultiline = isMultiline(sdtPr);
       
        sdt.getSdtContent().getContent().clear();
       
        sdt.getSdtContent().getContent().addAll(
            this.xpathGenerateRuns(
              (WordprocessingMLPackage)pkg, part,
              sdtPr,
              sdtPr.getDataBinding(),
              //sdtParent, contentChild,
              null, isMultiline));
       
      } else if (sdtPr.getDataBinding()!=null && !isRichText(sdtPr) ) {
        // TODO and not(w:sdtPr/w:docPartGallery)
        // .. but which is that?
            //@XmlElementRef(name = "docPartList", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
            //@XmlElementRef(name = "docPartObj", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
       
        sdt.getSdtContent().getContent().clear();
       
        sdt.getSdtContent().getContent().addAll(
            this.xpathGenerateRuns(
              (WordprocessingMLPackage)pkg, part,
              sdtPr,
              sdtPr.getDataBinding(),
              //sdtParent, contentChild,
              null, false));
       
      } else {
       
View Full Code Here

    @Override
    public void apply(SdtElement element, Object parent, List<Object> siblings) {

      System.out.println();
     
      SdtPr sdtPr = element.getSdtPr();
      if (sdtPr==null) {
        System.out.println(callback.indent + element.getClass().getSimpleName() + "  [no sdtPr!]" + " (having parent " + parent.getClass().getSimpleName() + ")");
      } else {       
        System.out.println(callback.indent + element.getClass().getSimpleName()  + " (having parent " + parent.getClass().getSimpleName() + ")");
       
        CTDataBinding binding = (CTDataBinding) XmlUtils.unwrap(sdtPr
            .getDataBinding());
        if (binding!=null) {
          System.out.println(callback.indent + "  binding: " + binding.getXpath() );         
        }
       
        Tag tag = sdtPr.getTag();
        if (tag == null)
          return;

        System.out.println(callback.indent + "  " + tag.getVal() );         
       
View Full Code Here

      this.definedStoreItemIds = definedStoreItemIds;
    }
   
    @Override
    public void apply(SdtElement element) {
    SdtPr sdtPr = element.getSdtPr();
     
      if ((sdtPr.getDataBinding() != null) &&
        (sdtPr.getDataBinding().getStoreItemID() != null)) {
        String tmp = sdtPr.getDataBinding().getStoreItemID().toLowerCase();
        if (definedStoreItemIds.contains(tmp)) {
          storeItemId = tmp;
          throw new BreakException();
        }
      }
View Full Code Here

    }

    Variable v = ds.findVariable("time_offset");
    v.addAttribute(new Attribute( "units", "seconds since "+dfo.toDateTimeString(start)));

    Group root = ds.getRootGroup();
    root.addAttribute(new Attribute( "Convention", "Suomi-Station-CDM"));   
    ds.finish();
  }
View Full Code Here

  public void testEosMetadata() {
    //NetcdfFile ncfile = TestH5.open("c:/data/hdf5/HIRDLS/HIRDLS2_v0.3.1-aIrix-c3_2003d106.h5");
    NetcdfFile ncfile = TestH5.open(testDir +"HIRDLS2-Aura73p_b029_2000d275.he5");

    Group root = ncfile.getRootGroup();
    Group g = root.findGroup("HDFEOS INFORMATION");
    Variable dset = g.findVariable("StructMetadata.0");
    assert(null != dset );
    assert(dset.getDataType() == DataType.CHAR);

    // read entire array
    Array A;
    try {
      A = dset.read();
    }
    catch (IOException e) {
      System.err.println("ERROR reading file");
      assert(false);
      return;
    }
    assert(A.getRank() == 1);
    assert (A instanceof ArrayChar);

    ArrayChar ca = (ArrayChar) A;
    String sval = ca.getString();
    System.out.println(dset.getFullName());
    System.out.println(" Length = "+sval.length());
    System.out.println(" Value = "+sval);

    ////////////////
    dset = g.findVariable("coremetadata.0");
    assert(null != dset );
    assert(dset.getDataType() == DataType.CHAR);

    // read entire array
    try {
View Full Code Here

    public int doAct(String filename) throws IOException {
      NetcdfFile ncfile = null;

      try {
        ncfile = NetcdfFile.open(filename);
        Group root = ncfile.getRootGroup();
        Group g = root.findGroup("HDFEOS INFORMATION");
        if (g == null) g = ncfile.getRootGroup();

        Variable dset = g.findVariable("StructMetadata.0");
        if (dset != null) {
          System.out.println("EOS file=" + filename);
          return 1;
        }
View Full Code Here

    public void setSearchPath(final String... groupNames) {
        final Group[] groups = new Group[groupNames.length];
        int count = 0;
        for (final String name : groupNames) {
            if (name != null) {
                final Group group = file.findGroup(name);
                if (group == null) {
                    continue; // Group not found - do not increment the counter.
                }
                groups[count] = group;
            }
View Full Code Here

     */
    @Override
    public String[] getSearchPath() {
        final String[] path = new String[groups.length];
        for (int i=0; i<path.length; i++) {
            final Group group = groups[i];
            if (group != null) {
                path[i] = group.getShortName();
            }
        }
        return path;
    }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.SdtPr$Group

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.