Run Visiting order

Hi,


I would like to know why does the DocumentVisitor visit the document in this order? For me, this is strange behavior. In the middle of paragraph, it visits the run from Text Box and then continue to visit runs from paragraph.

The document is attached.

Here is the code I used:

Document document = new Document(“2906_one_page.docx”);
document.accept(new DocumentVisitor() {

@Override
public int visitRun(Run run) throws Exception {
System.out.println(run.getText());
return super.visitRun(run);
}
@Override
public int visitShapeStart(Shape shape) throws Exception {
System.out.println("—Shape start—");
return super.visitShapeStart(shape);
}
@Override
public int visitShapeEnd(Shape shape) throws Exception {
System.out.println("—Shape end—");
return super.visitShapeEnd(shape);
}

});

And here is the example of the output:

This manual does not explain or discuss clinical surgical
—Shape start—
warning
—Shape end—
procedures. Therefore, the healthcare professional using

I’m using Aspose.Words 14.3.0.

Thanks,
Zeljko

Hi Zeljko,

Thanks for your inquiry. Please check the attached image (Warning Shape.png). The warning textbox is inside paragraph. Its layout is ‘In Front of text’. Please set it to ‘In line with text’ and check the output. The textbox will be shown inside paragraph.

Moreover, please check the attached DOM.png to see how Aspose.Words import this textbox in DOM. Aspose.Words correctly import it into DOM. Hope this answers your query. Please let us know if you have any more queries.