no message

This commit is contained in:
Bernaldo Mihasi 2022-03-24 09:43:13 +02:00
parent 864b4bfec8
commit 78895a1df1
1 changed files with 13 additions and 8 deletions

View File

@ -16,6 +16,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.util.Units; import org.apache.poi.util.Units;
import org.apache.poi.xwpf.usermodel.*; import org.apache.poi.xwpf.usermodel.*;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
@ -378,6 +379,7 @@ public class WordBuilder {
if((format == null || format.isEmpty()) || (attribute == null || attribute.isEmpty())){ if((format == null || format.isEmpty()) || (attribute == null || attribute.isEmpty())){
return null; return null;
} }
try {
JSONArray array = new JSONArray(JavaToJson.objectStringToJson(format)); JSONArray array = new JSONArray(JavaToJson.objectStringToJson(format));
StringBuilder multipleFormats = new StringBuilder(); StringBuilder multipleFormats = new StringBuilder();
for (int i = 0; i < array.length(); i++) { for (int i = 0; i < array.length(); i++) {
@ -387,6 +389,9 @@ public class WordBuilder {
multipleFormats.setLength(multipleFormats.length() - 2); multipleFormats.setLength(multipleFormats.length() - 2);
} }
return multipleFormats.toString(); return multipleFormats.toString();
} catch (JSONException e) {
return format;
}
} }
public XWPFParagraph addParagraphContent(Object content, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) { public XWPFParagraph addParagraphContent(Object content, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {