Skip to content

Cells borders overlaping and width misalignment #216

@RedHeadIvan

Description

@RedHeadIvan

When I create tables and nested tables, the borders of adjacent cells do not overlap. Instead, the borders become thicker, as if adding up.
The UseVariableBorders property doesn't help, so I decided to individually set the border thickness of each side of the cell.

Code looks like this:

for (int i = 0; i < 5; i++)
       {
           PdfPCell currentCell = new PdfPCell(new Phrase(i.ToString(), normal));
           currentCell.BorderWidthBottom = thinLineWidth;
           currentCell.BorderWidthLeft = thinLineWidth;
           currentCell.BorderWidthRight = thinLineWidth;
           currentCell.BorderWidthTop = boldLineWidth;
           currentCell.Padding = 0;
           currentCell.FixedHeight = mmtop(height);
           table.AddCell(currentCell);
           table.WriteSelectedRows(0, -1, mmtop(x), mmtop(y), canvas);
        }

But result looks bad. Also you can see summing of border width between cells 3 and 4 here

Image

I've noticed that if I set BorderWidth (not Top/Right etc) missalignmentt dissapears

for (int i = 0; i < 5; i++)
       {
           PdfPCell currentCell = new PdfPCell(new Phrase(i.ToString(), normal));
           currentCell.BorderWidth = boldLineWidth;
           currentCell.Padding = 0;
           currentCell.FixedHeight = mmtop(height);
           table.AddCell(currentCell);
           table.WriteSelectedRows(0, -1, mmtop(x), mmtop(y), canvas);
        }
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions