diff --git a/src/main/java/w2phtml/pageSplitters/TableCellSplitter.java b/src/main/java/w2phtml/pageSplitters/TableCellSplitter.java index a0654b6..e2f5bc7 100644 --- a/src/main/java/w2phtml/pageSplitters/TableCellSplitter.java +++ b/src/main/java/w2phtml/pageSplitters/TableCellSplitter.java @@ -9,6 +9,7 @@ import static w2phtml.office.XMLString.TEXT_SOFT_PAGE_BREAK; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import pro.litvinovg.xml.Debug; import w2phtml.office.OfficeReader; public class TableCellSplitter extends BasicSplitter implements ISplitter { @@ -40,10 +41,16 @@ public class TableCellSplitter extends BasicSplitter implements ISplitter { results.setDataMoved(true); } } else if (nodeName.equals(TEXT_LIST)) { - if (factory.split(cellChildNode).isDataMoved()){ - cellFirstPart.appendChild(cellChildNode.getPreviousSibling()); + SplitResults listSplitResults = factory.split(cellChildNode); + if (listSplitResults.isDataMoved()){ + //Debug.prettyPrintXml(cellNode.getOwnerDocument()); + cellFirstPart.appendChild(listSplitResults.getFirstPart()); results.setDataMoved(true); + //Debug.prettyPrintXml(cellNode.getOwnerDocument()); } + if (!cellChildNode.hasChildNodes()) { + cellNode.removeChild(cellChildNode); + } } else if (nodeName.equals(TABLE_TABLE)) { if (factory.split(cellChildNode).isDataMoved()){ cellFirstPart.appendChild(cellChildNode.getPreviousSibling()); @@ -69,6 +76,8 @@ public class TableCellSplitter extends BasicSplitter implements ISplitter { if (results.isDataMoved()) { parent.insertBefore(cellFirstPart, cellNode); } + //Debug.prettyPrintXml(cellNode.getOwnerDocument()); + return results; }