List runContent = r.getRunContent();
List runContent = r.getRunContent();
List runContent = r.getRunContent();
private void addRunToDocFrag(JaxbXmlPart sourcePart, List<Object> contents, String string, RPr rPr) { org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } org.docx4j.wml.Text text = Context.getWmlObjectFactory().createText(); run.getRunContent().add(text); if (string.startsWith(" ") || string.endsWith(" ") ) { // TODO: tab character? text.setSpace("preserve"); } text.setValue(string); contents.add(run); }
private void addBrRunToDocFrag(List<Object> contents, RPr rPr) throws JAXBException { // Not sure whether there is ever anything of interest in the rPr, // but add it anyway org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } run.getRunContent().add(Context.getWmlObjectFactory().createBr()); contents.add(run); }
private static org.docx4j.wml.R createRunStructure(String textVal, P existingP, int rIndex ) { org.docx4j.wml.R newR = wmlFactory.createR(); org.docx4j.wml.Text newT = wmlFactory.createText(); newR.getRunContent().add(newT); newT.setValue(textVal); newT.setSpace("preserve"); org.docx4j.wml.RPr existingRPr = ((org.docx4j.wml.R)existingP.getParagraphContent().get(rIndex)).getRPr(); if ( existingRPr !=null ) newR.setRPr(existingRPr); return newR; }
protected void addBrRunToDocFrag(DocumentFragment docfrag, RPr rPr) throws Docx4JException { // Not sure whether there is ever anything of interest in the rPr, // but add it anyway org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } run.getRunContent().add(Context.getWmlObjectFactory().createBr()); Document tmpDoc = XmlUtils.marshaltoW3CDomDocument(run); XmlUtils.treeCopy(tmpDoc.getDocumentElement(), docfrag); }
private void addRunToDocFrag(JaxbXmlPart sourcePart, DocumentFragment docfrag, String string, RPr rPr) { org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } org.docx4j.wml.Text text = Context.getWmlObjectFactory().createText(); run.getRunContent().add(text); if (string.startsWith(" ") || string.endsWith(" ") ) { // TODO: tab character? log.debug("setting xml:space=preserve for '" + string + "'"); text.setSpace("preserve"); } text.setValue(string); Document tmpDoc = XmlUtils.marshaltoW3CDomDocument(run); // avoid WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it. // but NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. // at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.importNode // docfrag.appendChild(fragdoc.importNode(document, true)); // so: XmlUtils.treeCopy(tmpDoc.getDocumentElement(), docfrag); }
.createRCommentReference(); cr.setId( (BigInteger)id); r.getRunContent().add(cr);
List runContent = r.getRunContent();
List runContent = r.getRunContent();
List runContent = r.getRunContent();
private void addBrRunToDocFrag(List<Object> contents, RPr rPr) throws JAXBException { // Not sure whether there is ever anything of interest in the rPr, // but add it anyway org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } run.getRunContent().add(Context.getWmlObjectFactory().createBr()); contents.add(run); }
private void addRunToDocFrag(JaxbXmlPart sourcePart, List<Object> contents, String string, RPr rPr) { org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } org.docx4j.wml.Text text = Context.getWmlObjectFactory().createText(); run.getRunContent().add(text); if (string.startsWith(" ") || string.endsWith(" ") ) { // TODO: tab character? text.setSpace("preserve"); } text.setValue(string); contents.add(run); }
protected void addBrRunToDocFrag(DocumentFragment docfrag, RPr rPr) throws Docx4JException { // Not sure whether there is ever anything of interest in the rPr, // but add it anyway org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } run.getRunContent().add(Context.getWmlObjectFactory().createBr()); Document tmpDoc = XmlUtils.marshaltoW3CDomDocument(run); XmlUtils.treeCopy(tmpDoc.getDocumentElement(), docfrag); }
private static org.docx4j.wml.R createRunStructure(String textVal, P existingP, int rIndex ) { org.docx4j.wml.R newR = wmlFactory.createR(); org.docx4j.wml.Text newT = wmlFactory.createText(); newR.getRunContent().add(newT); newT.setValue(textVal); newT.setSpace("preserve"); org.docx4j.wml.RPr existingRPr = ((org.docx4j.wml.R)existingP.getParagraphContent().get(rIndex)).getRPr(); if ( existingRPr !=null ) newR.setRPr(existingRPr); return newR; }
private void addRunToDocFrag(JaxbXmlPart sourcePart, DocumentFragment docfrag, String string, RPr rPr) { org.docx4j.wml.R run = Context.getWmlObjectFactory().createR(); if (rPr!=null) { run.setRPr(rPr); } org.docx4j.wml.Text text = Context.getWmlObjectFactory().createText(); run.getRunContent().add(text); if (string.startsWith(" ") || string.endsWith(" ") ) { // TODO: tab character? log.debug("setting xml:space=preserve for '" + string + "'"); text.setSpace("preserve"); } text.setValue(string); Document tmpDoc = XmlUtils.marshaltoW3CDomDocument(run); // avoid WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it. // but NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. // at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.importNode // docfrag.appendChild(fragdoc.importNode(document, true)); // so: XmlUtils.treeCopy(tmpDoc.getDocumentElement(), docfrag); }
run.getRunContent().add(drawing); drawing.getAnchorOrInline().add(inline);
ObjectFactory factory = Context.getWmlObjectFactory(); CTSimpleField ctSimple = factory.createCTSimpleField(); ctSimple.setInstr(" MergeField fieldValue \\* MERGEFORMAT "); RPr RPr = factory.createRPr(); RPr.setNoProof(new BooleanDefaultTrue()); Text t = factory.createText(); t.setValue("fieldValue"); R run = factory.createR(); run.getRunContent().add(RPr); run.getRunContent().add(t); ctSimple.getParagraphContent().add(run); JAXBElement<CTSimpleField> fldSimple = factory .createPFldSimple(ctSimple); // P P para = factory.createP(); para.getParagraphContent().add(fldSimple); Body body = factory.createBody(); body.getEGBlockLevelElts().add(para); wordMLPackage.getMainDocumentPart().addObject(body);
.createRCommentReference(); cr.setId( (BigInteger)id); r.getRunContent().add(cr);