iTextSharp 创建无边框表格
// 原网址:(15条消息) iTextSharp 创建无边框表格_知擎物联的博客-CSDN博客
iTextSharp.text.Table TbHead = new iTextSharp.text.Table(12); TbHead.DefaultHorizontalAlignment = 1; TbHead.Widths = new float[12] { 1.5F, 1.5F, 3, 1, 1, 1, 1, 1.5F, 1.5F, 2, 4, 3 };//列宽度 TbHead.Width = 100;//百分比宽度 TbHead.Border = 0; TbHead.DefaultCellBorderWidth = 0; TbHead.DefaultCellBorder = 0;
如果使用的是 PdfPTable ,那么在添加的单元格属性中设置Border=0
PdfPTable table = new PdfPTable(1); table.SetWidths(new[] { 100 }); table.WidthPercentage = 100; table.AddCell(new PdfPCell(myText) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE, FixedHeight = 100, Border = 0 });