iTextSharp NET删除单元格之间的间距

时间:2017-10-13 12:41:10

标签: c# .net itext

我正在尝试在一行中添加三个单元格,这些单元格具有相同颜色的彩色背景。问题是我看到这些单元格之间的空间(或垂直边框),但我不需要这个空间。

Result row image

正如您在图像上看到的那样,有一些空间。也许这是做我需要的错误方法。我需要在页面中心的这个绿色文本和右侧的同一行和相同背景颜色的白色文本。

这是我的代码:

    PdfPCell emptyCell = new PdfPCell();
    emptyCell.BackgroundColor = BaseColor.DARK_GRAY;
    emptyCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED;
    emptyCell.VerticalAlignment = Element.ALIGN_CENTER;
    emptyCell.MinimumHeight = 30f;
    emptyCell.Colspan = 3;
    emptyCell.Border = Rectangle.NO_BORDER;
    _currentTable.AddCell(emptyCell);

    iTextSharp.text.Font clubFont = new iTextSharp.text.Font(Font.FontFamily.HELVETICA, 12, Font.NORMAL, new BaseColor(0.541f, 0.765f, 0f));
    PdfPCell cell = new PdfPCell();
    Paragraph clubName = new Paragraph(clubString, clubFont) {Alignment = Element.ALIGN_CENTER};
    cell.AddElement(clubName);
    cell.BackgroundColor = BaseColor.DARK_GRAY;
    cell.HorizontalAlignment = Element.ALIGN_JUSTIFIED;
    cell.VerticalAlignment = Element.ALIGN_CENTER;
    cell.MinimumHeight = 30f;
    cell.Colspan = _currentTable.NumberOfColumns - 6;
    cell.Border = Rectangle.NO_BORDER;
    _currentTable.AddCell(cell);

    iTextSharp.text.Font dispFont = new iTextSharp.text.Font(Font.FontFamily.HELVETICA, 10, Font.NORMAL, BaseColor.WHITE);
    PdfPCell dispCell = new PdfPCell();
    Paragraph dispersion = new Paragraph(dispersionString, dispFont);
    dispersion.Alignment = Element.ALIGN_CENTER;
    dispCell.AddElement(dispersion);
    dispCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED;
    dispCell.VerticalAlignment = Element.ALIGN_CENTER;
    dispCell.MinimumHeight = 30f;
    dispCell.Colspan = 3;
    dispCell.BackgroundColor = BaseColor.DARK_GRAY;
    dispCell.Border = Rectangle.NO_BORDER;
    _currentTable.AddCell(dispCell);

0 个答案:

没有答案