【发布时间】:2012-10-10 17:57:09
【问题描述】:
我有一个 Aspose.Words 文档。 我想在文档的每一页上插入一个 TextBox Shape。
这是我的文件:
// Aspose.Words document
Document document = new Document();
// The DocumentBuilder
DocumentBuilder builder = new DocumentBuilder(document);
builder.insertHtml("Here, there is a big String with a lot of HTML.");
这是我为第一页做的:
Shape textBox = new Shape(document, ShapeType.TEXT_BOX);
textBox.setWrapType(WrapType.SQUARE);
// Shape position
textBox.setDistanceTop(0);
textBox.setDistanceLeft(42);
// Shape dimensions
textBox.setWidth(200);
textBox.setHeight(20);
// ... other options useless here.
// Paragraph, content of the Shape
Paragraph 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);
这非常适合第一页。
我也知道可以得到页数在做什么:
document.getPageCount();
但是我不知道如何浏览所有页面。
有什么建议吗?
【问题讨论】: