protected void populatePPr(PPr pPr, Styleable blockBox, Map<String, CSSValue> cssMap) { addParagraphProperties(pPr, blockBox, cssMap ); handleHeadingElement( pPr, blockBox); // (if its h1, h2 etc) } else { if (cssClass.equals("")) { handleHeadingElement( pPr, blockBox); // (if its h1, h2 etc) } else { log.debug("No docx style for @class='" + cssClass + "'"); handleHeadingElement( pPr, blockBox); // (if its h1, h2 etc) } else if (s.getType()!=null && s.getType().equals("paragraph")) { PStyle pStyle = Context.getWmlObjectFactory().createPPrBasePStyle(); log.debug("For docx style for @class='" + cssClass + "', but its not a paragraph style "); handleHeadingElement( pPr, blockBox); // (if its h1, h2 etc) addParagraphProperties(pPr, blockBox, cssMap ); } else if (isBidi(blockBox.getElement().getTextContent())) { log.debug(".. setting bidi property"); pPr.setBidi(new BooleanDefaultTrue() );
Object o = getListForRun(); if (o instanceof P) { P p = (P)o; this.addRun(cssClass, cssMap, theText.substring(start, end), !isEven(bidi.getRunLevel(i) )); // even means left to right this.addRun(cssClass, cssMap, theText, false);
addRunProperties(rPr, cssMap ); } else { addRunProperties(rPr, cssMap );
getCurrentParagraph(false), this.contentContextStack.peek()); getListForRun().getContent().add(run); run.getContent().add(Context.getWmlObjectFactory().createBr()); log.debug("Processing " + theText); String cssClass = getClassAttribute(s.getElement()); if (cssClass!=null) { cssClass=cssClass.trim(); addRuns(cssClass, cssMap, theText); bookmarkHelper.attachBookmarkEnd(markupRangeForID, getCurrentParagraph(false), this.contentContextStack.peek());
getCurrentParagraph(false), this.contentContextStack.peek()); Map<String, CSSValue> cssMap = getCascadedProperties(box.getStyle()); ContentAccessor ca = divHandler.enter(blockBox, this.contentContextStack.peek()); if (ca!=null) { pushBlockStack(ca); mustPop = true; && this.getCurrentParagraph(false)!=null && this.getCurrentParagraph(false).getPPr()!=null && this.getCurrentParagraph(false).getPPr().getNumPr()!=null ) { NumPr numPr = this.getCurrentParagraph(false).getPPr().getNumPr(); this.getCurrentParagraph(true).setPPr(this.getPPr(blockBox, cssMap)); this.getCurrentParagraph(false).getPPr().setNumPr(numPr); this.getCurrentParagraph(true).setPPr(this.getPPr(blockBox, cssMap)); P currentP = getCurrentParagraph(false); if (currentP!=null && currentP.getContent().size()==0) { pushBlockStack(tbl); mustPop = true; P currentP = getCurrentParagraph(false); if (currentP!=null && currentP.getContent().size()==0) {
CTMarkupRange inlineMarkupRange = bookmarkHelper.anchorToBookmark(s.getElement(), bookmarkNamePrefix, getCurrentParagraph(false), this.contentContextStack.peek()); if (inlineMarkupRange!=null) { bookmarkHelper.attachBookmarkEnd( inlineMarkupRange, getCurrentParagraph(false), this.contentContextStack.peek() ); markuprange = null; Map<String, CSSValue> cssMap = getCascadedProperties(s.getStyle()); P p = this.getCurrentParagraph(true); if (p.getPPr()==null) { PPr pPr = Context.getWmlObjectFactory().createPPr(); populatePPr(pPr, s, cssMap); // nb, since the element is likely to be null, this is unlikely to give us a @class; that's why we need to make the p in the enclosing div (or p). String cssClass = getClassAttribute(s.getElement()); if (cssClass!=null) { cssClass=cssClass.trim(); markuprange = bookmarkHelper.anchorToBookmark(s.getElement(), bookmarkNamePrefix, getCurrentParagraph(false), this.contentContextStack.peek()); if (markuprange!=null) { addRuns(cssClass, cssMap, theText); bookmarkHelper.attachBookmarkEnd(markuprange, getCurrentParagraph(false), this.contentContextStack.peek()); markuprange = null; formatRPr(rPr, cssClass, cssMap); h = createHyperlink( href,
getRenderer().getLayoutContext()); // LayoutContext implements CssContext if (!box.getStyle().isMaxWidthNone()) { int maxWidth = box.getStyle().getMaxWidth(getRenderer().getLayoutContext(), 0); // revisit base value? .setMaxWidth( (int) dotsToTwip(maxWidth)); UnitsOfMeasurement.twipToEMU( dotsToTwip(contentBounds.height) ); Long cx = contentBounds.width==0 ? null : UnitsOfMeasurement.twipToEMU( dotsToTwip(contentBounds.width) ); this.getCurrentParagraph(true), box.getElement(), cx, cy);
if (part.getAltChunkType().equals(AltChunkType.Xhtml)) { try { XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordprocessingMLPackage); List results = xHTMLImporter.convert( htmlImportProcessor.processHtml(toString(part.getBuffer())), null);
private void addRun( String cssClass, Map<String, CSSValue> cssMap, String theText, boolean isRTL) { R run = Context.getWmlObjectFactory().createR(); Text text = Context.getWmlObjectFactory().createText(); text.setValue( theText ); if (theText.startsWith(" ") || theText.endsWith(" ") ) { text.setSpace("preserve"); } run.getContent().add(text); getListForRun().getContent().add(run); // Run level styling RPr rPr = Context.getWmlObjectFactory().createRPr(); run.setRPr(rPr); formatRPr(rPr, cssClass, cssMap); if (isRTL) { rPr.setRtl(new BooleanDefaultTrue()); } }
public XHTMLImporterImpl(WordprocessingMLPackage wordMLPackage) { displayFormattingOptionSettings(); initStyleMap(wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart());
if (part.getAltChunkType().equals(AltChunkType.Xhtml)) { try { XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordprocessingMLPackage); List results = xHTMLImporter.convert( htmlImportProcessor.processHtml(toString(part.getBuffer())), null);