我尝试使用这段代码,但由于某种原因它无法运行..
var table : SimpleTable = new SimpleTable();
table.widthPercentage = 100;
table.borderWidth = 1;
var row : SimpleCell = new SimpleCell( SimpleCell.ROW );
row.border = 1;
row.borderColor = RGBColor.fromARGB( 0x555555 );
row.borderWidth = 1;
row.verticalAlignment = Element.ALIGN_MIDDLE;
var cell1 : SimpleCell = new SimpleCell( SimpleCell.CELL );
cell1.widthpercentage = 25;
cell1.verticalAlignment = Element.ALIGN_MIDDLE;
var p : Paragraph = new Paragraph( 'test', PurePDFGenerator.pdf.cyrillicFont );
p.alignment = Element.ALIGN_MIDDLE;
cell1.add( p );
row.add( cell1 );
table.add( row );
答案 0 :(得分:2)
在Paragraph.alignment工作之前,您可以使用
cell.horizontalAlignment = Element.ALIGN_CENTER;
答案 1 :(得分:1)
您是否尝试在细胞水平进行水平对齐?从我所看到的,它应该来自文档。另外,你不是要将你的段落添加到你的单元格吗?