Java Code Examples for org.docx4j.wml.PPr#getSpacing()
The following examples show how to use
org.docx4j.wml.PPr#getSpacing() .
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: WmlElementUtils.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * @param isSpace * 是否设置段前段后值 * @param before * 段前磅数 * @param after * 段后磅数 * @param beforeLines * 段前行数 * @param afterLines * 段后行数 * @param isLine * 是否设置行距 * @param lineValue * 行距值 * @param sTLineSpacingRule * 自动auto 固定exact 最小 atLeast 1磅=20 1行=100 单倍行距=240 */ public void setParagraphSpacing(P p, boolean isSpace, String before, String after, String beforeLines, String afterLines, boolean isLine, String lineValue, STLineSpacingRule sTLineSpacingRule) { PPr pPr = getPPr(p); Spacing spacing = pPr.getSpacing(); if (spacing == null) { spacing = new Spacing(); pPr.setSpacing(spacing); } if (isSpace) { if (StringUtils.isNotBlank(before)) { // 段前磅数 spacing.setBefore(new BigInteger(before)); } if (StringUtils.isNotBlank(after)) { // 段后磅数 spacing.setAfter(new BigInteger(after)); } if (StringUtils.isNotBlank(beforeLines)) { // 段前行数 spacing.setBeforeLines(new BigInteger(beforeLines)); } if (StringUtils.isNotBlank(afterLines)) { // 段后行数 spacing.setAfterLines(new BigInteger(afterLines)); } } if (isLine) { if (StringUtils.isNotBlank(lineValue)) { spacing.setLine(new BigInteger(lineValue)); } if (sTLineSpacingRule != null) { spacing.setLineRule(sTLineSpacingRule); } } }
Example 2
Source File: Docx4j_工具类_S3_Test.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * @param isSpace * 是否设置段前段后值 * @param before * 段前磅数 * @param after * 段后磅数 * @param beforeLines * 段前行数 * @param afterLines * 段后行数 * @param isLine * 是否设置行距 * @param lineValue * 行距值 * @param sTLineSpacingRule * 自动auto 固定exact 最小 atLeast 1磅=20 1行=100 单倍行距=240 */ public void setParagraphSpacing(P p, boolean isSpace, String before, String after, String beforeLines, String afterLines, boolean isLine, String lineValue, STLineSpacingRule sTLineSpacingRule) { PPr pPr = getPPr(p); Spacing spacing = pPr.getSpacing(); if (spacing == null) { spacing = new Spacing(); pPr.setSpacing(spacing); } if (isSpace) { if (StringUtils.isNotBlank(before)) { // 段前磅数 spacing.setBefore(new BigInteger(before)); } if (StringUtils.isNotBlank(after)) { // 段后磅数 spacing.setAfter(new BigInteger(after)); } if (StringUtils.isNotBlank(beforeLines)) { // 段前行数 spacing.setBeforeLines(new BigInteger(beforeLines)); } if (StringUtils.isNotBlank(afterLines)) { // 段后行数 spacing.setAfterLines(new BigInteger(afterLines)); } } if (isLine) { if (StringUtils.isNotBlank(lineValue)) { spacing.setLine(new BigInteger(lineValue)); } if (sTLineSpacingRule != null) { spacing.setLineRule(sTLineSpacingRule); } } }