Beispiel #1
0
  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,
       *  and this element specifies the formatting which shall be used for non-placeholder
       *  text contents when they are initially added to the control. "
       *
       * Note that docx2fo.xslt is co-opting this to do something else.
       */
    }
    return sdtBlock;
  }