设置删除线

显示效果:

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

 示例代码

package test.create.c01;

import iofd.layout.OfdDocument;
import iofd.layout.block.Paragraph;
import iofd.layout.block.paragraph.Text;
import test.create.TestDocUtil;

/**
 * 设置删除线示例
 * */
public class C0114SetFontDeleteLine {

	public static void main(String[] args) throws Throwable {
		C0114SetFontDeleteLine o = new C0114SetFontDeleteLine();
		o.done();
	}

	private void done() throws Throwable {
		String clzName = this.getClass().getSimpleName();
		System.out.println(clzName + " begin");
		
		OfdDocument doc = new OfdDocument();
		
		String s;
		Paragraph p;
		Text text;
		
		s = "这是加删除线的示例";
		p = new Paragraph();
		text = new Text(s);
		text.setDeleteline(true);
		p.add(text);
		doc.add(p);
		
		p = new Paragraph();
		text = new Text(s);
		text.setDeleteline(true);
		text.setSize(24d);
		p.add(text);
		doc.add(p);
		
		p = new Paragraph();
		text = new Text(s);
		text.setDeleteline(true);
		text.setSize(36d);
		p.add(text);
		doc.add(p);
		
		p = new Paragraph();
		text = new Text(s);
		/*
		 * 设置删除线
		 * */
		text.setDeleteline(true);
		text.setSize(48d);
		p.add(text);
		doc.add(p);
		
		String fileName = TestDocUtil.getOfdFilePath(this.getClass());
		doc.save(fileName);
		System.out.println(clzName + " end");
	}
}