设置多行文字
示例代码
package test.create.c08;
import iofd.layout.DefaultPageProperty;
import iofd.layout.OfdDocument;
import iofd.layout.block.Paragraph;
import iofd.layout.block.header.PageHeaderLine;
import iofd.layout.block.paragraph.Text;
import iofd.layout.block.tailer.PageFooterPanel;
import iofd.layout.element.SimpleElement;
import java.util.ArrayList;
import java.util.List;
import test.create.TestDocUtil;
/**
*
* */
public class C0802PageFooterMultiLineText {
public static void main(String[] args) throws Throwable {
C0802PageFooterMultiLineText o = new C0802PageFooterMultiLineText();
o.done();
}
private void done() throws Throwable {
String clzName = this.getClass().getSimpleName();
System.out.println(clzName + " begin");
OfdDocument doc = new OfdDocument();
DefaultPageProperty prop = DefaultPageProperty.createDefaultPageProperty();
prop.setDebug(true);
prop.setHeadLine(new PageHeaderLine());
List footerCreator = new ArrayList<>();
List list = new ArrayList<>();
list.add(new Text("第一行测试页尾信息"));
list.add(new Text("第二行测试页尾信息"));
PageFooterPanel headerInfo = new PageFooterPanel(list);
footerCreator.add(headerInfo);
prop.setFooterCreator(footerCreator);
doc.setDefaultPageProperty(prop);
String s = "在页尾显示部分多行文字信息";
Paragraph p = new Paragraph();
p.add(new Text(s));
doc.add(p);
String fileName = TestDocUtil.getOfdFilePath(this.getClass());
doc.save(fileName);
System.out.println(clzName + " end");
}
}