diff --git a/src/main/java/w2phtml/xhtml/content/TextParser.java b/src/main/java/w2phtml/xhtml/content/TextParser.java
index d8a6d34..6e8e871 100644
--- a/src/main/java/w2phtml/xhtml/content/TextParser.java
+++ b/src/main/java/w2phtml/xhtml/content/TextParser.java
@@ -168,10 +168,10 @@ public class TextParser extends Parser {
if (pagination) {
//ODFPageSplitter.splitOfficeText(onode, ofr);
- //Debug.prettyPrintXml(onode);
+ //Debug.prettyPrintXml(onode.getOwnerDocument());
SplitFactory splitters = new SplitFactory(ofr);
splitters.split(onode);
- //Debug.prettyPrintXml(onode);
+ //Debug.prettyPrintXml(onode.getOwnerDocument());
}
hnode = (Element)traverseBlockText(onode,hnode);
@@ -430,10 +430,14 @@ public class TextParser extends Parser {
if (!displayHiddenText && "none".equals(Misc.getAttribute(onode,TEXT_DISPLAY))) { return hnode; }
- if (pageWasOpened && !inTable) {hnode = docSep.closePage(hnode);}
+ if (pageWasOpened && !inTable) {
+ hnode = docSep.closePage(hnode);
+ }
boolean removeStyleAtExit = setSectionStyle(onode);
- if (pageWasOpened && !inTable) {hnode = docSep.openPage(hnode, pageNum);}
+ if (pageWasOpened && !inTable) {
+ hnode = docSep.openPage(hnode, pageNum);
+ }
hnode = traverseBlockText(onode, hnode);
if (isLast) {
insertEndnotes((Element) hnode, sectionName);
@@ -445,6 +449,11 @@ public class TextParser extends Parser {
pageContainer.removeStyle();
}
+ if ( docSep.isPageOpened()) {
+ hnode = docSep.closePage(hnode);
+ hnode = docSep.openPage(hnode, pageNum);
+ }
+
return hnode;
}