读书人

iText学习札记二_基本构建块(basic b

发布时间: 2012-08-28 12:37:01 作者: rapoo

iText学习笔记二_基本构建块(basic building blocks)

1.iText基本构建包括Chunk,Phrase,Paragraph,Achor,List,ListItem,Chapter,Section,Image,PdfPTable,PdfPCell,ColumnText等

?

2.Document中的add方法的参数是Element,以上那些类都直接或间接的是Elment的扩展。

?

3.Chunks 文本块,

?? Phrases 短语,由一系列Chunk组成

???Paragraph 段落,由一系列Chunk或Phrase组成

?? Achor 超链接(可内链和外链)

???ListItem?Paragraph的一个子类,不可以直接添加到document中,要先加入List中

???PdfPTable 表格组件

?? PdfPCell 单元格组件

?

3.需要注意到是PdfPCell在构建时有两种方式:

1.PdfPCell cell = new PdfPCell(new Paragraph("some text"));

2.PdfPCell cell = new PdfPCell();

cell.addElement(new Paragraph("some text"));

?

第一种称为 Text Mode,paragraph的属性被忽略;

第二种称为Composite Mode,paragraph的属性是有效的。

?

读书人网 >编程

热点推荐