本文整理匯總了Java中org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline類的典型用法代碼示例。如果您正苦於以下問題:Java STUnderline類的具體用法?Java STUnderline怎麽用?Java STUnderline使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
STUnderline類屬於org.openxmlformats.schemas.wordprocessingml.x2006.main包,在下文中一共展示了STUnderline類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processSingleItem
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline; //導入依賴的package包/類
void processSingleItem(XWPFDocument document, String citationText, String abstractText, String handleUrl) {
XWPFParagraph para = document.createParagraph();
XWPFRun run = para.createRun();
run.setText(StringUtils.isNotBlank(citationText) ? citationText : "(no citation)");
para.setSpacingAfter(200);
if (StringUtils.isNotBlank(handleUrl)) {
// from http://stackoverflow.com/a/22456273/72625
String linkId = document.getPackagePart().addExternalRelationship(handleUrl, XWPFRelation.HYPERLINK.getRelation()).getId();
para = document.createParagraph();
para.setSpacingAfter(200);
XWPFRun linkPrefix = para.createRun();
CTText linkPrefixText = linkPrefix.getCTR().addNewT();
linkPrefixText.setStringValue("AgScite record: ");
linkPrefixText.setSpace(SpaceAttribute.Space.PRESERVE);
CTHyperlink link = para.getCTP().addNewHyperlink();
link.setId(linkId);
CTText linkText = CTText.Factory.newInstance();
linkText.setStringValue(handleUrl);
CTR ctr = CTR.Factory.newInstance();
ctr.setTArray(new CTText[]{linkText});
ctr.addNewRPr().addNewColor().setVal("0000FF");
ctr.addNewRPr().addNewU().setVal(STUnderline.SINGLE);
link.setRArray(new CTR[]{ctr});
}
if (includeAbstract && StringUtils.isNotBlank(abstractText)) {
// split md string at double newline so we can create actual paragraphs
String[] abstractParas = abstractText.split("\r?\n\r?\n");
for (String abstractPara : abstractParas) {
para = document.createParagraph();
run = para.createRun();
run.setText(abstractPara);
para.setSpacingAfter(200);
para.setIndentationLeft(200);
}
}
para.setSpacingAfter(600); // override spacing for final para
}