com.deepoove.poi.util.ParagraphUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of poi-tl Show documentation
Show all versions of poi-tl Show documentation
Generate word(docx) with template
package com.deepoove.poi.util;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
public final class ParagraphUtils {
public static String trimLine(XWPFParagraph paragraph) {
String value = paragraph.getText();
int len = value.length();
int st = 0;
char[] val = value.toCharArray();
while ((st < len) && (val[st] == '\n')) {
st++;
}
while ((st < len) && (val[len - 1] == '\n')) {
len--;
}
return (st > 0 || len < value.length()) ? value.substring(st, len) : value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy