本文整理汇总了Java中org.apache.poi.xwpf.usermodel.XWPFRun.addBreak方法的典型用法代码示例。如果您正苦于以下问题:Java XWPFRun.addBreak方法的具体用法?Java XWPFRun.addBreak怎么用?Java XWPFRun.addBreak使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.xwpf.usermodel.XWPFRun
的用法示例。
在下文中一共展示了XWPFRun.addBreak方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTableText
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
private static void addTableText(XWPFRun rh, String text) {
if (text == null) {
rh.setText("null");
return;
}
String[] split = text.split("\n");
int size = split.length;
for (int i = 0; i < size; i++) {
String d = split[i];
rh.setText(ValueUtil.leftTrim(d));
if (i < size - 1) {
rh.addBreak();
}
}
}
示例2: insertMPagination
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
/**
* Insert the given {@link MPagination}.
*
* @param paragraph
* the {@link XWPFParagraph} to modify
* @param run
* the {@link XWPFRun} to insert to
* @param mPagination
* the {@link MPagination}
* @return the last inserted {@link XWPFParagraph}
*/
private XWPFParagraph insertMPagination(XWPFParagraph paragraph, XWPFRun run, MPagination mPagination) {
final XWPFParagraph res;
switch (mPagination) {
case newColumn:
run.addBreak(BreakType.COLUMN);
res = paragraph;
break;
case newParagraph:
res = createNewParagraph(generatedDocument, (XWPFParagraph) run.getParent());
break;
case newPage:
run.addBreak(BreakType.PAGE);
res = paragraph;
break;
case newTableOfContent:
CTP ctP = paragraph.getCTP();
CTSimpleField toc = ctP.addNewFldSimple();
toc.setInstr("TOC \\h");
toc.setDirty(STOnOff.TRUE);
res = paragraph;
break;
case newTextWrapping:
run.addBreak(BreakType.TEXT_WRAPPING);
res = paragraph;
break;
default:
throw new IllegalStateException("Not supported MPagination.");
}
return res;
}
示例3: insertString
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
/**
* Insert the given text into to given {@link XWPFRun}. This take care of new lines and tabulations.
*
* @param paragraph
* the {@link XWPFParagraph} to modify
* @param srcRun
* the {@link XWPFRun} to populate
* @param text
* the text to insert
* @return the last inserted {@link XWPFRun}.
*/
private XWPFRun insertString(XWPFParagraph paragraph, XWPFRun srcRun, String text) {
int fragmentStart = 0;
XWPFRun inserted;
for (int i = 0; i < text.length(); i++) {
final char current = text.charAt(i);
switch (current) {
case '\n':
inserted = insertFragment(paragraph, srcRun, text.substring(fragmentStart, i));
inserted.addBreak();
fragmentStart = i + 1;
break;
case '\t':
inserted = insertFragment(paragraph, srcRun, text.substring(fragmentStart, i));
inserted.addTab();
fragmentStart = i + 1;
break;
case '\r':
// CHECKSTYLE:OFF
if (i + 1 < text.length() && text.charAt(i + 1) == '\n') {
inserted = insertFragment(paragraph, srcRun, text.substring(fragmentStart, i));
inserted.addBreak();
i++;
fragmentStart = i + 1;
}
// CHECKSTYLE:ON
break;
default:
break;
}
}
return insertFragment(paragraph, srcRun, text.substring(fragmentStart, text.length()));
}
示例4: setWordText
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
/**
* 支持换行操作
* @param currentRun
* @param currentText
*/
public static void setWordText(XWPFRun currentRun, String currentText) {
if (StringUtils.isNotBlank(currentText)) {
String[] tempArr = currentText.split("\r\n");
for (int i = 0, le = tempArr.length - 1; i < le; i++) {
currentRun.setText(tempArr[i], i);
currentRun.addBreak();
}
currentRun.setText(tempArr[tempArr.length - 1], tempArr.length - 1);
}
}
示例5: FillDocument
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
private void FillDocument(Voter voter, XWPFRun run) {
run.setText("Dear :" + "\t" + voter.getName());
run.addBreak();
run.setText("User :" + "\t" + voter.getEmail());
run.addBreak();
run.setText("Password :" + "\t" + voter.getPassword());
run.addBreak();
run.setText("Thanks for using our service, hope all went well.");
run.addBreak();
run.setText(new Date().toString());
}
示例6: addBreak
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
/**
* 줄바꿈한다.
*/
public void addBreak() {
XWPFParagraph p = doc.createParagraph();
XWPFRun r1 = new KrXWPFRun(p.createRun());
r1.addBreak();
}
示例7: addNewPage
import org.apache.poi.xwpf.usermodel.XWPFRun; //导入方法依赖的package包/类
/**
* 새로운 페이지로 넘긴다.
*/
public void addNewPage() {
XWPFParagraph p = doc.createParagraph();
XWPFRun r1 = p.createRun();
r1.addBreak(BreakType.PAGE);
}