当前位置: 首页>>代码示例>>Java>>正文


Java RPr.setRStyle方法代码示例

本文整理汇总了Java中org.docx4j.wml.RPr.setRStyle方法的典型用法代码示例。如果您正苦于以下问题:Java RPr.setRStyle方法的具体用法?Java RPr.setRStyle怎么用?Java RPr.setRStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.docx4j.wml.RPr的用法示例。


在下文中一共展示了RPr.setRStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRun

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
private R createRun(final String styleId, final String text) {
	final R r = this.wmlObjectFactory.createR();

	final RPr rpr = this.wmlObjectFactory.createRPr();
	r.setRPr(rpr);

	if (styleId != null) {
		final RStyle rstyle = this.wmlObjectFactory.createRStyle();
		rstyle.setVal(styleId);
		rpr.setRStyle(rstyle);
	}

	final Text textElement = this.wmlObjectFactory.createText();
	textElement.setValue(text);
	final JAXBElement<Text> wrappedText = this.wmlObjectFactory.createRT(textElement);
	r.getContent().add(wrappedText);

	return r;
}
 
开发者ID:mizitch,项目名称:story-inspector,代码行数:20,代码来源:DocXReportSummaryWriter.java

示例2: apply

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
@Override
public void apply(R r, Object parent, List<Object> siblings) {
	SingleTraversalUtilVisitorCallback runVisitor = new SingleTraversalUtilVisitorCallback(new TraversalUtiltextVisitor());
	runVisitor.walkJAXBElements(r);
	if (textFound) {
		runWithTextFound = true;
		ObjectFactory wmlObjectFactory = new ObjectFactory();
		RPr rpr = wmlObjectFactory.createRPr();
		r.setRPr(rpr);
           // Create object for rStyle
           RStyle rstyle = wmlObjectFactory.createRStyle(); 
           rpr.setRStyle(rstyle); 
           rstyle.setVal(inlineStyleId);
	}
	textFound = false;
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:17,代码来源:InlineStyleUtil.java

示例3: setPlaceHolderContent

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
public void setPlaceHolderContent(String text) {
	contentControl.getSdtContent().getContent().clear();
	Text t = wFactory.createText();
	t.setValue(text);

	RStyle style = wFactory.createRStyle();
	style.setVal("PlaceholderText");
	RPr placeHolderProperties = wFactory.createRPr();
	placeHolderProperties.setRStyle(style);

	R run = wFactory.createR();
	run.setRPr(placeHolderProperties);
	run.getContent().add(t);
	setContent(run);
}
 
开发者ID:wte4j,项目名称:wte4j,代码行数:16,代码来源:PlainTextContent.java

示例4: newHyperlink

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
public org.docx4j.wml.P.Hyperlink newHyperlink(MainDocumentPart mdp, String text, String url) {
		try {
			// We need to add a relationship to word/_rels/document.xml.rels but since its external, we don't use 
			// the usual wordMLPackage.getMainDocumentPart().addTargetPart mechanism
			org.docx4j.relationships.ObjectFactory factory = new org.docx4j.relationships.ObjectFactory();
			org.docx4j.relationships.Relationship rel = factory.createRelationship();
			rel.setType(Namespaces.HYPERLINK);
			rel.setTarget(url);
			rel.setTargetMode("External");
			mdp.getRelationshipsPart().addRelationship(rel);
			// addRelationship sets the rel's @Id
			
			org.docx4j.wml.P.Hyperlink hyp = new org.docx4j.wml.P.Hyperlink();
			hyp.setId(rel.getId());
			R run = Context.getWmlObjectFactory().createR();
			hyp.getContent().add(run);
			RPr rpr = new RPr();
			RStyle rStyle = new RStyle();
			rStyle.setVal("Hyperlink");
			rpr.setRStyle(rStyle);			
			run.setRPr(rpr);
			
			Text t = new Text();
			t.setValue(text);
			run.getContent().add(t);
//			String hpl = "<w:hyperlink r:id=\"" + rel.getId()
//					+ "\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" "
//					+ "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" >" + "<w:r>" + "<w:rPr>"
//					+ "<w:rStyle w:val=\"Hyperlink\" />" + 
//					"</w:rPr>" + "<w:t>" + text + "</w:t>" + "</w:r>" + "</w:hyperlink>";
//			return (org.docx4j.wml.P.Hyperlink) XmlUtils.unmarshalString(hpl);
			return hyp;
		} catch (Exception e) {			
			e.printStackTrace();
			return null;
		}
	}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:38,代码来源:DocxExporter.java


注:本文中的org.docx4j.wml.RPr.setRStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。