本文整理汇总了Java中org.apache.poi.xwpf.usermodel.BreakType类的典型用法代码示例。如果您正苦于以下问题:Java BreakType类的具体用法?Java BreakType怎么用?Java BreakType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BreakType类属于org.apache.poi.xwpf.usermodel包,在下文中一共展示了BreakType类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.poi.xwpf.usermodel.BreakType; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p = doc.createParagraph();
String imgFile = "aspose.jpg";
XWPFRun r = p.createRun();
int format = XWPFDocument.PICTURE_TYPE_JPEG;
r.setText(imgFile);
r.addBreak();
r.addPicture(new FileInputStream(imgFile), format, imgFile, Units.toEMU(200), Units.toEMU(200)); // 200x200 pixels
r.addBreak(BreakType.PAGE);
FileOutputStream out = new FileOutputStream("data/Apache_ImagesInDoc.docx");
doc.write(out);
out.close();
System.out.println("Process Completed Successfully");
}
示例2: main
import org.apache.poi.xwpf.usermodel.BreakType; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithimages/insertimage/data/";
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p = doc.createParagraph();
String imgFile = dataPath + "aspose.jpg";
XWPFRun r = p.createRun();
int format = XWPFDocument.PICTURE_TYPE_JPEG;
r.setText(imgFile);
r.addBreak();
r.addPicture(new FileInputStream(imgFile), format, imgFile, Units.toEMU(200), Units.toEMU(200)); // 200x200 pixels
r.addBreak(BreakType.PAGE);
FileOutputStream out = new FileOutputStream(dataPath + "Apache_ImagesInDoc_Out.docx");
doc.write(out);
out.close();
System.out.println("Process Completed Successfully");
}
示例3: insertMPagination
import org.apache.poi.xwpf.usermodel.BreakType; //导入依赖的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;
}
示例4: addSourceTablesAppendix
import org.apache.poi.xwpf.usermodel.BreakType; //导入依赖的package包/类
private static void addSourceTablesAppendix(CustomXWPFDocument document, ETL etl) {
XWPFParagraph paragraph = document.createParagraph();
XWPFRun run = paragraph.createRun();
run.addBreak(BreakType.PAGE);
run.setText("Appendix: source tables");
run.setFontSize(18);
for (Table sourceTable : etl.getSourceDatabase().getTables()) {
paragraph = document.createParagraph();
run = paragraph.createRun();
run.setText("Table: " + sourceTable.getName());
run.setFontSize(14);
createDocumentParagraph(document, sourceTable.getComment());
XWPFTable table = document.createTable(sourceTable.getFields().size() + 1, 4);
// table.setWidth(2000);
XWPFTableRow header = table.getRow(0);
setTextAndHeaderShading(header.getCell(0), "Field");
setTextAndHeaderShading(header.getCell(1), "Type");
setTextAndHeaderShading(header.getCell(2), "Most freq. value");
setTextAndHeaderShading(header.getCell(3), "Comment");
int rowNr = 1;
for (Field sourceField : sourceTable.getFields()) {
XWPFTableRow row = table.getRow(rowNr++);
row.getCell(0).setText(sourceField.getName());
row.getCell(1).setText(sourceField.getType());
if (sourceField.getValueCounts() != null && sourceField.getValueCounts().length != 0)
row.getCell(2).setText(sourceField.getValueCounts()[0][0]);
createCellParagraph(row.getCell(3), sourceField.getComment().trim());
}
}
run.setFontSize(18);
}
示例5: addNewPage
import org.apache.poi.xwpf.usermodel.BreakType; //导入依赖的package包/类
/**
* 새로운 페이지로 넘긴다.
*/
public void addNewPage() {
XWPFParagraph p = doc.createParagraph();
XWPFRun r1 = p.createRun();
r1.addBreak(BreakType.PAGE);
}