Package org.docx4j.wml

Examples of org.docx4j.wml.Style$Name


  }
 
    protected static Style createVirtualStylesForDocDefaults(FontScheme fontScheme) {
     
    ObjectFactory factory = Context.getWmlObjectFactory();
    Style style = factory.createStyle();
     
      String ROOT_NAME = "DocDefaults";
     
      style.setStyleId(ROOT_NAME);
      style.setType("paragraph");
   
    Name styleName = factory.createStyleName();
    styleName.setVal(ROOT_NAME);
    style.setName(styleName);
   
//    <w:rPr>
    RPr rPr = factory.createRPr();
    style.setRPr(rPr);

//    <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" />
    RFonts rFonts = factory.createRFonts();
    rFonts.setAscii( fontScheme.getMinorFont().getLatin().getTypeface() );
    rPr.setRFonts(rFonts);
View Full Code Here


   
    // Second iteration - paragraph level pPr *and rPr*
    result.append("\n /* PARAGRAPH STYLES */ \n");     
    Tree<AugmentedStyle> pTree = styleTree.getParagraphStylesTree();   
      for (org.docx4j.model.styles.Node<AugmentedStyle> n : pTree.toList() ) {
        Style s = n.getData().getStyle();

        result.append( "."+ s.getStyleId()  + " {display:block;" );
          if (s.getPPr()==null) {
            log.debug("null pPr for style " + s.getStyleId());
          } else {
            HtmlCssHelper.createCss(context.getPmlPackage(), s.getPPr(), result, false );
          }
          if (s.getRPr()==null) {
            log.debug("null rPr for style " + s.getStyleId());
          } else {
            HtmlCssHelper.createCss(context.getPmlPackage(), s.getRPr(), result);
          }
          result.append( "}\n" );         
      }
               
      if (log.isDebugEnabled()) {
View Full Code Here

    // Initialise styles
    styles = (org.docx4j.wml.Styles)styleDefinitionsPart.getJaxbElement()
    initialiseLiveStyles();   
   
    Style docDefaults = styleDefinitionsPart.getStyleById("DocDefaults");
    log.debug(XmlUtils.marshaltoString(docDefaults, true, true));
    documentDefaultPPr = docDefaults.getPPr();
    documentDefaultRPr = docDefaults.getRPr();

      addNormalToResolvedStylePPrComponent();
    addDefaultParagraphFontToResolvedStyleRPrComponent();
  }
View Full Code Here

      fillTableStyleStack(styleId, tableStyleStack);
    } else {
      log.debug("No table style specified");
    }
   
    Style result;
    if (tableStyleStack.size()>0 ) {
      result = XmlUtils.deepCopy(tableStyleStack.pop());
    } else {
      result = Context.getWmlObjectFactory().createStyle();
      CTTblPrBase emptyPr = Context.getWmlObjectFactory().createCTTblPrBase();
      result.setTblPr(emptyPr);
      if (tblPr==null) {
        // Return empty style object
        log.info("Generated empty tblPr" );
        return result;
      }     
    }
    while (!tableStyleStack.empty() ) {
      StyleUtil.apply(tableStyleStack.pop(), result);
    }
   
    // Finally apply the tblPr we were passed
    result.setTblPr(StyleUtil.apply(tblPr, result.getTblPr()));
   
    // Sanity check
    if (result.getTblPr()==null) {
      log.error("Null tblPr. FIXME" );
    }
   
    return result;
  }
View Full Code Here

   * @param stylename
   * @param effectivePPr
   */
  private void fillTableStyleStack(String styleId, Stack<Style> tableStyleStack) {
    // get the style
    Style style = liveStyles.get(styleId);
   
    // add it to the stack
    if (style==null) {
      // No such style!
      // For now, just log it..
      log.error("Style definition not found: " + styleId);
      return;
    }
   
    tableStyleStack.push(style);
    log.debug("Added " + styleId + " to table style stack");
   
    // if it is based on, recurse
      if (style.getBasedOn()==null) {
      log.debug("Style " + styleId + " is a root style.");
      } else if (style.getBasedOn().getVal()!=null) {
          String basedOnStyleName = style.getBasedOn().getVal();            
          fillTableStyleStack( basedOnStyleName, tableStyleStack);
      } else {
        log.debug("No basedOn set for: " + style.getStyleId() );
      }
   
  }
View Full Code Here

    if (resolvedPPr!=null) {
      return resolvedPPr;
    }
   
    // Hmm, have to do the work
    Style s = liveStyles.get(styleId);
   
    if (s==null) {
      log.error("Couldn't find style: " + styleId);
      return null;
    }
View Full Code Here

    if (resolvedRPr!=null) {
      return resolvedRPr;
    }
   
    // Hmm, have to do the work
    Style s = liveStyles.get(styleId);
   
    if (s==null) {     
      log.error("Couldn't find style: " + styleId);
      log.debug("Couldn't find style: " + styleId, new Throwable());
      return null;
View Full Code Here

      }
      return;
    }
   
    // get the style
    Style style = liveStyles.get(styleId);
   
    // add it to the stack
    if (style==null) {
      // No such style!
      // For now, just log it..
      if (styleId!=null
          && styleId.equals("DocDefaults")) {
       
        // Don't worry about this.
        // SDP.createVirtualStylesForDocDefaults()
        // creates a DocDefaults style, and makes Normal based on it
        // (and so if a different approach to handling
        //  DocDefaults ... we really should do it one
        //  way consistently).
        // The problem here is, that is typically done
        // after the PropertyResolver is created,
        // so as far as this PropertyResolver is
        // concerned, the style doesn't exist.
        // And we don't really want to always
        // do createVirtualStylesForDocDefaults() before
        // or during init of PropertyResolver, since that
        // mean any docx saved would contain those
        // virtual styles.
        // Anyway, we don't need to worry about it
        // here, because the doc defaults are still handled...
       
      } else {
        log.error("Style definition not found: " + styleId);
      }
      return;
    }
   
    // For heading styles, check the outline level is as expected
    if (styleId.startsWith(HEADING_STYLE)) {
     
      int level = getLvlFromHeadingStyle(styleId);
      if (level>0
          && style.getPPr()!=null
          && style.getPPr().getOutlineLvl()!=null
          && style.getPPr().getOutlineLvl().getVal()!=null
          && style.getPPr().getOutlineLvl().getVal().intValue()!=(level-1)) {
       
        // must use the outline level appropriate to this heading!
        // No need to clone, since Microsoft Word automatically overwrites like this!
        log.info(styleId + " - reset actual outline level with " + (level-1));
        style.getPPr().getOutlineLvl().setVal(BigInteger.valueOf(level-1));
      }
     
      pPrStack.push(style.getPPr());       
    } else {
      pPrStack.push(style.getPPr());
    }
   
    log.debug("Added " + styleId + " to pPr stack");
   
    // Some styles contain numPr, without specifying
    // their numId!  In this case you have to get it
    // from the numPr in their basedOn style.
    // To save numbering emulator from having to do
    // that work, we make the numId explicit here.
    boolean ascertainNumId = false;
    if (style.getPPr()!=null
        && style.getPPr().getNumPr()!=null
        && style.getPPr().getNumPr().getNumId()==null) {

      ascertainNumId = true;     
      log.debug(styleId +" ascertainNumId: " + ascertainNumId);
    } else {
      log.debug(styleId +" ascertainNumId: " + ascertainNumId);     
    }
   
    // if it is based on, recurse
      if (style.getBasedOn()==null) {
      log.debug("Style " + styleId + " is a root style.");
      } else if (style.getBasedOn().getVal()!=null) {
          String basedOnStyleName = style.getBasedOn().getVal();            
      log.debug("Style " + styleId + " is based on " + basedOnStyleName);
          fillPPrStack( basedOnStyleName, pPrStack);
          Style basedOnStyle = liveStyles.get(basedOnStyleName);
          if (ascertainNumId && basedOnStyle!=null) {
            // This works via recursion           
            //log.debug( XmlUtils.marshaltoString(basedOnStyle, true, true));
            if (basedOnStyle.getPPr()!=null
                && basedOnStyle.getPPr().getNumPr()!=null
                && basedOnStyle.getPPr().getNumPr().getNumId()!=null) {
              NumId numId = basedOnStyle.getPPr().getNumPr().getNumId();
              // Attach it at this level - for this to work,
              // you can't have a style in the basedOn hierarchy
              // which doesn't have a numPr element, because
              // in that case there is nowhere to hang the style
              style.getPPr().getNumPr().setNumId(numId);
View Full Code Here

   * @param effectivePPr
   */
  private void fillRPrStack(String styleId, Stack<RPr> rPrStack) {
   
    // get the style
    Style style = liveStyles.get(styleId);
   
    // add it to the stack
    if (style==null) {
      // No such style!
      // For now, just log it..
      log.error("Style definition not found: " + styleId);
      return;
    }
    rPrStack.push(style.getRPr());
    log.debug("Added " + styleId + " to rPr stack");
   
    // if it is based on, recurse
      if (style.getBasedOn()==null) {
      log.debug("Style " + styleId + " is a root style.");
      } else if (style.getBasedOn().getVal()!=null) {
          String basedOnStyleName = style.getBasedOn().getVal();            
          fillRPrStack( basedOnStyleName, rPrStack);
      } else {
        log.debug("No basedOn set for: " + style.getStyleId() );
      }
   
  }
View Full Code Here

      for (String string : findQualifyers) {
        findQualifiers.getFindQualifier().add(string);
      }
      findBusiness.setFindQualifiers(findQualifiers);

      Name name = new Name();
      name.setValue(nameStr);
      findBusiness.getName().add(name);


      logger.debug("FindBusiness " + findBusiness + " sending findBusinesses request..");
      List<Business> businesses = new ArrayList<Business>();
View Full Code Here

TOP

Related Classes of org.docx4j.wml.Style$Name

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.