We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a6f4c3 commit 840dda7Copy full SHA for 840dda7
pdftable/src/main/java/com/leshchenko/pdftable/Column.kt
@@ -32,7 +32,16 @@ class Column(
32
33
fun setColumnHeight(height: Float) {
34
this.height = height
35
- cells.forEach { it.cellHeight = height / cells.size }
+ var availableHeight = height / cells.size
36
+ cells.forEachIndexed { index, cell ->
37
+ val estimatedHeight = cell.getEstimatedHeight()
38
+ if (estimatedHeight > availableHeight) {
39
+ cell.cellHeight = estimatedHeight
40
+ availableHeight = (height - estimatedHeight) / (cells.size - (index + 1))
41
+ } else {
42
+ cell.cellHeight = availableHeight
43
+ }
44
45
}
46
47
fun isDrawn() = cells.all { it.isDrawn }
0 commit comments