diff --git a/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/HtmlToWorldBuilder.java b/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/HtmlToWorldBuilder.java index c77f851..ab4d917 100644 --- a/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/HtmlToWorldBuilder.java +++ b/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/HtmlToWorldBuilder.java @@ -2,6 +2,7 @@ package org.opencdmp.filetransformer.docx.service.wordfiletransformer.word; import org.apache.poi.xwpf.usermodel.*; import org.apache.xmlbeans.XmlCursor; +import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; @@ -61,6 +62,10 @@ public class HtmlToWorldBuilder implements NodeVisitor { @Override public void head(Node node, int i) { + + String htmlToPlainText = Jsoup.parse(node.outerHtml()).text(); + if (htmlToPlainText.trim().isEmpty()) return; + String name = node.nodeName(); if (name.equals("#text")) { String text = ((TextNode)node).text();