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


Java XWPFParagraph.setSpacingAfter方法代码示例

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


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

示例1: createCellText

import org.apache.poi.xwpf.usermodel.XWPFParagraph; //导入方法依赖的package包/类
public void createCellText(XWPFTableCell cell) {
	XWPFParagraph paragraph;
	// If no header is set, use the cell's default paragraph.
	if (cell.getParagraphs().get(0).getRuns().size() == 0)
		paragraph = cell.getParagraphs().get(0);
	else
		paragraph = cell.addParagraph();

	XWPFRun run = paragraph.createRun();
	run.setBold(isBold);
	run.setText(text);
	run.setFontFamily(fontFamily);
	run.setFontSize(fontSize);
	paragraph.setAlignment(alignment);
	paragraph.setSpacingAfter(10);
	paragraph.setSpacingBefore(topMargin);
	paragraph.setIndentationLeft(leftMargin);
	paragraph.setIndentationRight(50);
	paragraph.setIndentationHanging(hangingIndent);
	if (bottomBorder)
		paragraph.setBorderBottom(Borders.SINGLE);
}
 
开发者ID:FraunhoferCESE,项目名称:HazardTrackingSystem,代码行数:23,代码来源:ParagraphBuilder.java

示例2: createCellHeader

import org.apache.poi.xwpf.usermodel.XWPFParagraph; //导入方法依赖的package包/类
public void createCellHeader(XWPFTableCell cell) {
	XWPFParagraph p;
	if (cell.getParagraphs().get(0).getRuns().size() == 0)
		p = cell.getParagraphs().get(0);
	else
		p = cell.addParagraph();

	p.setAlignment(alignment);
	p.setSpacingBefore(beforeSpacing);
	p.setIndentationLeft(20);
	p.setSpacingAfter(100);
	XWPFRun rHeading = p.createRun();
	rHeading.setText(text.toUpperCase());
	rHeading.setFontFamily("Arial");
	rHeading.setFontSize(6);
	rHeading.setBold(isBold);
}
 
开发者ID:FraunhoferCESE,项目名称:HazardTrackingSystem,代码行数:18,代码来源:CellHeaderBuilder.java

示例3: fillTable

import org.apache.poi.xwpf.usermodel.XWPFParagraph; //导入方法依赖的package包/类
/**
 * Fill a newly created word table with the data from an MTable.
 * 
 * @param table
 *            The newly created word table
 * @param mtable
 *            The MTable that describes the data and styles to insert
 */
private void fillTable(XWPFTable table, MTable mtable) {
    List<MRow> rows = mtable.getRows();
    // Iterate over the rows
    for (int rowIdx = 0; rowIdx < rows.size(); rowIdx++) {
        MRow mRow = rows.get(rowIdx);

        // Get or create XWPF row
        XWPFTableRow xwpfRow;
        if (table.getNumberOfRows() > rowIdx) {
            xwpfRow = table.getRow(rowIdx);
        } else {
            xwpfRow = table.createRow();
        }

        // Iterate over the columns
        for (int colIdx = 0; colIdx < mtable.getColumnsCount(); colIdx++) {
            // Get or create XWPF cell
            XWPFTableCell xwpfCell;
            if (xwpfRow.getTableCells().size() > colIdx) {
                xwpfCell = xwpfRow.getCell(colIdx);
            } else {
                xwpfCell = xwpfRow.createCell();
            }

            // Populate cell
            XWPFParagraph xwpfCellParagraph = xwpfCell.getParagraphs().get(0);
            xwpfCellParagraph.setSpacingBefore(0);
            xwpfCellParagraph.setSpacingAfter(0);
            MCell mCell = null;
            if (colIdx < mRow.getCells().size()) {
                mCell = mRow.getCells().get(colIdx);
            }
            setCellContent(xwpfCell, mCell);
        }
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:45,代码来源:M2DocEvaluator.java

示例4: processSingleItem

import org.apache.poi.xwpf.usermodel.XWPFParagraph; //导入方法依赖的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
}
 
开发者ID:UoW-IRRs,项目名称:API-Extras,代码行数:48,代码来源:WordCitationExportCrosswalk.java


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