diff --git a/goextVersion.go b/goextVersion.go index b9f1d8a..9c1dec5 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.496" +const GoextVersion = "0.0.497" -const GoextVersionTimestamp = "2024-08-07T15:34:06+0200" +const GoextVersionTimestamp = "2024-08-07T17:04:59+0200" diff --git a/wpdf/wpdfTable.go b/wpdf/wpdfTable.go index 6d71a75..69f8b11 100644 --- a/wpdf/wpdfTable.go +++ b/wpdf/wpdfTable.go @@ -289,23 +289,28 @@ func (b *TableBuilder) calculateColumns() []float64 { return columnWidths } - for i, _ := range columnDef { - if frColumnWeights[i] != 0 { - w := min(autoWidths[i], (remainingWidth/float64(frColumnWidthCount))*frColumnWeights[i]) - remainingWidth += columnWidths[i] - columnWidths[i] = w - remainingWidth -= w + { + rmSub := 0.0 + for i := range columnDef { + if frColumnWeights[i] != 0 { + w := min(autoWidths[i], (remainingWidth/float64(frColumnWidthCount))*frColumnWeights[i]) + rmSub += w - columnWidths[i] + columnWidths[i] = w + } } + remainingWidth -= rmSub } - if remainingWidth > 0 { + if remainingWidth > 0.01 { + rmSub := 0.0 for i, _ := range columnDef { if frColumnWeights[i] != 0 { addW := (remainingWidth / float64(frColumnWidthCount)) * frColumnWeights[i] + rmSub += addW columnWidths[i] += addW - remainingWidth -= addW } } + remainingWidth -= rmSub } return columnWidths