自动分页
示例代码
package test.create.c02;
import iofd.layout.OfdDocument;
import iofd.layout.block.Paragraph;
import iofd.layout.block.paragraph.Text;
import test.create.TestDocUtil;
/**
* 展示如何自动的分页,当一页无法填充所有内容的时候,需要通过分页的方式增加页面以填充内容
* */
public class C0209LargeContent {
public static void main(String[] args) throws Throwable {
C0209LargeContent o = new C0209LargeContent();
o.done();
}
private void done() throws Throwable {
String clzName = this.getClass().getSimpleName();
System.out.println(clzName + " begin");
OfdDocument doc = new OfdDocument();
/*
* 展示如何自动的分页,当一页无法填充所有内容的时候,
* 需要通过分页的方式增加页面以填充内容
* */
for(int i = 0; i < 100; i++) {
Paragraph p = new Paragraph();
Text text = new Text("第" + i + "行");
p.add(text);
doc.add(p);
}
String fileName = TestDocUtil.getOfdFilePath(this.getClass());
doc.save(fileName);
System.out.println(clzName + " end");
}
}