Defining list length in Template seems to work now

This commit is contained in:
2025-12-19 10:47:05 +01:00
parent 9d1398b397
commit 59755c4516
17 changed files with 773 additions and 134 deletions
+18
View File
@@ -0,0 +1,18 @@
package pdfrender
// FillToCapacity fills a slice to a specified capacity with empty items
// This ensures tables render with the correct number of empty rows
func FillToCapacity[T any](items []T, capacity int) []T {
if len(items) >= capacity {
return items
}
// Create filled slice with capacity
filled := make([]T, capacity)
// Copy existing items
copy(filled, items)
// Remaining items are already zero-valued
return filled
}