@Override public List<Object> apply(Object o) { if (firstSectPr==null && (o instanceof P)) { P p = (P)o; if ( p.getPPr()!=null && p.getPPr().getSectPr()!=null ) { // System.out.println("Found sectpr!"); enclosingP = (P)o; // just for sample MergeBlockRangeNViaTraversalUtilsSectPr firstSectPr = p.getPPr().getSectPr(); } } return null; }
@Override public List<Object> apply(Object o) { if (o instanceof org.docx4j.wml.P && ((org.docx4j.wml.P)o).getPPr() != null && ((org.docx4j.wml.P)o).getPPr().getSectPr() != null ) { // this sdt contains a sectPr, so add it // and all its ancestor sdts to the ones we need to delete for (SdtBlock sdt : ll) { if (!sdtBlocks.contains(sdt) ) { sdtBlocks.add((SdtBlock)sdt); } } } return null; }
private PPr getEffectivePPr(P p) { PPr pPrDirect = p.getPPr(); return propertyResolver.getEffectivePPr(pPrDirect); }
private Map<P, ResultTriple> numberParagraphs(List<P> pList) { org.docx4j.openpackaging.parts.WordprocessingML.NumberingDefinitionsPart numberingPart = wordMLPackage.getMainDocumentPart().getNumberingDefinitionsPart(); Map<P, ResultTriple> pNumbersMap = new HashMap<P, ResultTriple>(); if (numberingPart==null) { return pNumbersMap; } numberingPart.getEmulator(true); // reset counters //PropertyResolver propertyResolver = wordMLPackage.getMainDocumentPart().getPropertyResolver(); for (P p : pList) { if (p.getPPr()!=null) { ResultTriple triple = Emulator.getNumber(wordMLPackage, p.getPPr()); pNumbersMap.put(p, triple); } } return pNumbersMap; }
public static void process(WordprocessingMLPackage wmlPackage) { Body body = wmlPackage.getMainDocumentPart().getJaxbElement().getBody(); if (body==null || body.getContent().size()==0) { log.warn("w:document/w:body null or empty"); return; } Object o = body.getContent().get(0); if (o instanceof P && ((P)o).getPPr()!=null) { PPr pPr = ((P)o).getPPr(); BooleanDefaultTrue val = new BooleanDefaultTrue(); val.setVal(Boolean.FALSE); pPr.setPageBreakBefore(val); } } }
private P canonicaliseInstance(P p) { P newP = Context.getWmlObjectFactory().createP(); newP.setPPr(p.getPPr()); newR = Context.getWmlObjectFactory().createR(); // fieldRPr = null; stack = new LinkedList<FieldRef>(); if(log.isDebugEnabled()) { log.debug(XmlUtils.marshaltoString(p)); } handleContent(p.getContent(), newP); // log.debug(XmlUtils.marshaltoString(newP, true)); return newP; }
if (((org.docx4j.wml.P)o).getPPr() != null ) { org.docx4j.wml.PPr ppr = ((org.docx4j.wml.P)o).getPPr(); if (ppr.getSectPr()!=null) { sectPrs.add(ppr.getSectPr()); Object last = all.get( all.size()-1 ); if (last instanceof P && ((P) last).getPPr()!=null && ((P) last).getPPr().getSectPr() !=null) { SectPr thisSectPr = ((P) last).getPPr().getSectPr(); document.getBody().setSectPr(thisSectPr); ((P) last).getPPr().setSectPr(null); sectPrs.remove(thisSectPr);
if ( p.getPPr()==null ) { p.setPPr( Context.getWmlObjectFactory().createPPr() ); if (p.getPPr().getPStyle()==null) { p.getPPr().setPStyle(Context.getWmlObjectFactory().createPPrBasePStyle() ); if (tblStack.size()==0) { p.getPPr().getPStyle().setVal(newStyle); } else { p.getPPr().getPStyle().setVal(newStyle); } else { p.getPPr().getPStyle().setVal(resultStyle); PStyle pstyle = p.getPPr().getPStyle(); String styleVal = pstyle.getVal(); if (styleVal!=null) { log.debug("getCellPStyle returned null, so leave as is"); } else { p.getPPr().getPStyle().setVal(newStyle);
for(P p: pList){ ppr = p.getPPr(); if(ppr == null){ // TODO FIXME: Normal could be required in TOC continue;
pPr = ((P)o).getPPr(); if (stylesInUse != null) { //do the styles boolean customPStyle = false;