I have an Aspose.Words document. I would like to insert a TextBox Shape on each page of my document.
This is my document:
// Aspose.Words documentDocument document = new Document();// The DocumentBuilderDocumentBuilder builder = new DocumentBuilder(document);builder.insertHtml("Here, there is a big String with a lot of HTML.");
This is how I do it for the first page:
Shape textBox = new Shape(document, ShapeType.TEXT_BOX);textBox.setWrapType(WrapType.SQUARE);// Shape positiontextBox.setDistanceTop(0);textBox.setDistanceLeft(42);// Shape dimensionstextBox.setWidth(200);textBox.setHeight(20);// ... other options useless here.// Paragraph, content of the ShapeParagraph paragraph = new Paragraph(document);Run run = new Run(document);run.setText("Here some text.");paragraph.appendChild(run);textBox.appendChild(paragraph);// Now I insert my Shape on the first page.builder.moveToDocumentStart();builder.insertNode(textBox);
This is working great for the first page.
I also know that I can get the number of pages doing:
document.getPageCount();
However I do not know how to go through all the pages.
Any suggestions?