Hi,
can you say me why, when I insert cloned Nodes like in an example code, NodeSeparator and NodeEnd is not where is DocumentBuilder moved? You can see in DocumentExplorer that they Nodes are on the end paragraph not where is DocumentBuilder been on that moment, on node(you see in code I always move DocumentBuilder on Node who be cloned and insert)?
public class FieldNodes
{
protected List getDocumentParagraphs(com.aspose.words.Document document) throws Exception
{
final List paragraphList = new ArrayList();
document.accept(new DocumentVisitor()
{
@Override
public int visitParagraphStart(Paragraph paragraph)
throws Exception
{
paragraphList.add(paragraph);
return super.visitParagraphStart(paragraph);
}
});
return paragraphList;
}
@Test
public void test() throws Exception
{
String path = "/home/emisia/Desktop/bojan.doc";
Document document = new Document(path);
java.util.List list = getDocumentParagraphs(document);
DocumentBuilder builder = new DocumentBuilder(document);
for (Paragraph paragraph: list)
{
NodeCollection collection = paragraph.getChildNodes();
for (Node node: collection)
{
builder.moveTo(node);
builder.insertNode(node.deepClone(true));
}
}
document.save("/home/emisia/Desktop/bojan11.doc");
}
}
Thanks,
Bojan