居中显示

显示效果:

示例代码所生成的OFD文件:下载

 示例代码

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.contants.AlignmentType;
import iofd.layout.element.SimpleElement;

import java.util.ArrayList;
import java.util.List;

import test.create.TestDocUtil;

/**
 * 
 * */
public class C0803PageFooterMultiLineTextAlignCenter {

	public static void main(String[] args) throws Throwable {
		C0803PageFooterMultiLineTextAlignCenter o = new C0803PageFooterMultiLineTextAlignCenter();
		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);
		headerInfo.setAlign(AlignmentType.CENTER);
		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");
	}
	
}