Fix splitting lists in table cell

This commit is contained in:
Georgy Litvinov 2021-03-12 18:55:01 +01:00
parent 89f2807f4e
commit 17bf5a9259

View file

@ -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;
}