日期:2014-05-20  浏览次数:20856 次

itext设置字体的问题,谢谢大家
请问如何设置cell里面的字体大小啊代码有点乱,拷贝过来就是这样了,不好意思

public   Table   test(){
Table   t=null;
try   {
t   =   new   Table(1,2);

                t.setBorderColor(new   Color(0,   0,   255));//设置边框颜色为蓝色
                t.setPadding(5);
                t.setSpacing(5);//设置单元格边界
                t.setBorderWidth(1);//设置边框宽度
                Cell   c1   =   new   Cell( "header1 ");
                c1.setHeader(true);
               
                t.addCell(c1);
                c1   =   new   Cell( "Header2 ");
                t.addCell(c1);

}   catch   (BadElementException   e)   {
//   TODO   自动生成   catch   块
e.printStackTrace();
}
                return   t;
}

------解决方案--------------------
http://topic.csdn.net/t/20020627/08/832910.html你看看这个帖子,或许有帮助
------解决方案--------------------
把这个 Cell c1 = new Cell( "header1 "); 改成下面的九可以了

Cell c1 = new Cell(new Paragraph("header1 ",FontFactory.getFont("Fixedsys", 35)));

35就是字体的大小