NodeCollection<Paragraph> paras = document.getChildNodes(NodeType.PARAGRAPH, true);
for (AbstractFormatter formatter : formatters) {
if (!(formatter instanceof ChapterFormatter)) {
for (Paragraph paragraph : paras) {
if (paragraph.getParentNode() instanceof Body && StyleUtils.isNotToc(paragraph)) {
boolean confirmed = formatter.confirmTitle(paragraph);
if (formatter.isShouldBreakOnTrue() && confirmed) {
break;
}
}
}
}
}
for (AbstractFormatter formatter : formatters) {
if (!(formatter instanceof ChapterFormatter)){
formatter.formatTitle();
}
}
NodeCollection<Paragraph> devisedParas = document.getChildNodes(NodeType.PARAGRAPH, true);
for(Paragraph paragraph : devisedParas){
chapterFormatter.confirmTitle(paragraph);
}
chapterFormatter.formatTitle();
in the code above, i first get all the paragraphs using ‘paras’ , then in the ‘formatter.formatTitle()’ , one of the formatter, i used
for (Section section : getSections())
{
NodeCollection<Node> nodes = section.getBody()
.getChildNodes(NodeType.ANY, false);
for (Node node : nodes)
{
if (!titles.contains(node))
{
node.remove();
}
}
}
to remove some paragraphs that I dont want.
however, the second time i used NodeCollection<Paragraph> devisedParas = document.getChildNodes(NodeType.PARAGRAPH, true);
seems, the devisedParas
is same as paras
. how can i get the revised paragraphs ?