持续更新 iText in Action 2nd Edition中文版 个人翻译

93页

This chapter covers 本章包括

Constructing a  PdfPTable object构建一个PdfPtable对象

Exploring the properties of a  PdfPCell  object研究PdfPCell属性

Adding tables to the Document  object将表格添加到文档对象中去


iText has existed for more than ten years now. If you were to ask me which objects 

have  been  the  most  important  in  the  iText-related  projects  I’ve  done  in  all  those 

years, I wouldn’t have to think twice about the answer. Most of my assignments have 

consisted of creating reports that render the content of a database to a  PDF  docu -

ment.  This  content  had  to  be  organized  in  tabular  form.  This  can  be  achieved 

using two classes that are important enough to be the focus of an entire chapter: 

PdfPTable and PdfPCell . 

Text已经存在10年了,如果有人问在这10年中iText中哪个对象是最重要的话,本书的作者会毫不犹豫的说是PdfPTable和PdfPCell这两个对象。因为作者大部分的工作(相信也是大多数人的工作)就是从数据中取出数据然后在文档中以表格的形式呈现出来。因为两个类实在是太重要,这里我们会花费整个第二章的内容来详细说明。。


We’ll start with simple examples, then move on to more complex tables using 

the data from the movie database.

我们将从简单的例子开始,然后转移到用电影数据库中的数据做成的更复杂的表格上来。


4.1 Constructing tables

iText’s table functionality has evolved from a very low-level class in the early versions of 

iText to the twin classes Table  and PdfTable  in iText 0.30 (2000). These classes were use -

ful, but they had some flaws. It was hard to fine-tune them due to design decisions made 

by the iText developers; that is, by me. Developers wanted to define how to split the table 

upon a page break, to control the way borders are drawn, and so on. The  PdfPTable 

class, introduced by the codeveloper of iText, Paulo Soares, solved this problem.

 The  Table  and PdfTable  classes were removed in iText 5 (2009). So were  Simple-

Table  and SimpleCell , two other table classes discussed in the first edition of  iText in 

Action. Only  PdfPTable and PdfPCell  remain. They will be discussed in this chapter.


4.1构建表

在iText中处理Table的有很多老版本的类如Table和PdfTable,但是他们都有一些缺陷,而且在处理多页分割表格的情况下以及控制单元格等方面明显力不从心,所以引了PdfPTable类。

--------------------------------------------------

2012年10月23日0:19:23 

翻译的有不对的地方 欢迎指正。

转载请加入博客网址。

 参考http://www.cnblogs.com/julyluo/archive/2012/07/02/2573827.html,这个兄台讲的是C#方面的itext pdf的开发,我抽时间转成Java方面的来。需要一点时间。JulyLuo兄的翻译水平非常不错!值得学习。

原文地址:https://www.cnblogs.com/ae6623/p/4416643.html