prawnpdf / prawn-table

Provides support for tables in Prawn
Other
205 stars 98 forks source link

Internal table cells render incorrectly #126

Open rytkmt opened 3 years ago

rytkmt commented 3 years ago

Hey, first thanks for the great gem!

I wanna render like this.

image

but,

image

    inner_cell = make_table([["A"],["B"]]) { column(0).style(width: 70) }
    information_column_cell = make_table(
      [
        ["", ""],
        [{ content: "aa", colspan: 2 }],
        ["X", inner_cell],
        [{ content: "bb", colspan: 2 }],
      ],
      column_widths: [30, 70]
    ) do
      row(0).style(height: 0)
    end

    table(
      [
        ["", "", "", ""],
        ["a", information_column_cell, "b", "c"]
      ],
      column_widths: [100, 100,100,100]
    ) do
      row(0).style(height: 0)
    end

It can't render internal table cells correctly.

I do not know why, But I happened to render it correctly.

    inner_cell = make_table([["A"],["B"]]) { column(0).style(width: 60) }

    information_column_cell = make_table(
      [
        ["", "", ""],
        [{ content: "aa", colspan: 3 }],
        ["X", { content: inner_cell, colspan: 2 }],
        [{ content: "bb", colspan: 3 }],
      ],
      column_widths: [40, 60, 0]
    ) do
      row(0).style(height: 0)
    end

If i specify the height, it will be drawn incorrectly as well.

    inner_cell = make_table(
      [
        [{
          content: "A",
          height: 100
        }],
        [{
          content: "B",
          height: 200
        }],
      ]
    ) {

      column(0).style(width: 60)
    }

image

thanks.

raquelhortab commented 1 year ago

This happens to me too, quite a headache... But then I've read somewhere that this project is stable enough not to improve it further...