Java Code Examples for org.docx4j.wml.Br#setType()

The following examples show how to use org.docx4j.wml.Br#setType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Docx4J_例子2.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
public void addPageBreak(WordprocessingMLPackage wordMLPackage,
		ObjectFactory factory, STBrType sTBrType) {
	MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
	Br breakObj = new Br();
	breakObj.setType(sTBrType);
	P paragraph = factory.createP();
	paragraph.getContent().add(breakObj);
	documentPart.addObject(paragraph);
}
 
Example 2
Source File: Docx4J_简单例子2.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
public void addPageBreak(WordprocessingMLPackage wordMLPackage,  
        ObjectFactory factory) {  
    MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();  
    Br breakObj = new Br();  
    breakObj.setType(STBrType.PAGE);  
    P paragraph = factory.createP();  
    paragraph.getContent().add(breakObj);  
    documentPart.addObject(paragraph);  
}
 
Example 3
Source File: AddingAPageBreak.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
/**
 * 向文档添加一个换行符
 */
private static void addPageBreak() {
    MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
 
    Br breakObj = new Br();
    breakObj.setType(STBrType.PAGE);
 
    P paragraph = factory.createP();
    paragraph.getContent().add(breakObj);
    documentPart.getJaxbElement().getBody().getContent().add(paragraph);
}
 
Example 4
Source File: AddingPageNrToFooter.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a page break to the document.
 *
 * @param documentPart
 */
private static void addPageBreak(MainDocumentPart documentPart) {
    Br breakObj = new Br();
    breakObj.setType(STBrType.PAGE);
    P paragraph = factory.createP();
    paragraph.getContent().add(breakObj);
    documentPart.getJaxbElement().getBody().getContent().add(paragraph);
}
 
Example 5
Source File: Docx4J_简单例子.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
public void addPageBreak(WordprocessingMLPackage wordMLPackage,
		ObjectFactory factory) {
	MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
	Br breakObj = new Br();
	breakObj.setType(STBrType.PAGE);
	P paragraph = factory.createP();
	paragraph.getContent().add(breakObj);
	documentPart.addObject(paragraph);
}
 
Example 6
Source File: WmlElementUtils.java    From docx4j-template with Apache License 2.0 4 votes vote down vote up
/**
 * @Description: 段落添加Br 页面Break(分页符)
 */
public static void addPageBreak(P para, STBrType sTBrType) {
    Br breakObj = new Br();
    breakObj.setType(sTBrType);
    para.getContent().add(breakObj);
}
 
Example 7
Source File: Docx4j_工具类_S3_Test.java    From docx4j-template with Apache License 2.0 4 votes vote down vote up
/**
 * @Description: 段落添加Br 页面Break(分页符)
 */
public void addPageBreak(P para, STBrType sTBrType) {
    Br breakObj = new Br();
    breakObj.setType(sTBrType);
    para.getContent().add(breakObj);
}