<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ
昨晚寻找了网上很多关于IText表格居中问题,他们其中的有些代码我即使复制上去生成的doc表格的文字都是不居中的,后来我自己找出了一种居中方式: 为PdfPCell对象添加paragraph对象,并将该paragraph设置为居中: PdfPCell cell1 = new PdfPCell(); Paragraph para = new Paragraph("该单元居中"); //设置该段落为居中显示 para.setAlignment(1