File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
layout/src/main/java/com/itextpdf/layout/renderer Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -414,18 +414,23 @@ float[] autoLayout() {
414
414
} else {
415
415
float totalFixed = 0 ;
416
416
float totalFlexible = 0 ;
417
+ float flexibleCount = 0 ;
417
418
for (int i = 0 ; i < numberOfColumns ; i ++) {
418
419
if (widths [i ].isFixed ) {
419
420
widths [i ].finalWidth = widths [i ].width ;
420
421
totalFixed += widths [i ].width ;
421
422
} else if (!widths [i ].isPercent ) {
422
423
totalFlexible += widths [i ].width ;
424
+ flexibleCount ++;
423
425
}
424
426
}
427
+ assert totalFlexible > 0 || flexibleCount > 0 ;
425
428
extraWidth = tableWidth - totalPercent - totalFixed ;
426
429
for (int i = 0 ; i < numberOfColumns ; i ++) {
427
430
if (!widths [i ].isPercent && !widths [i ].isFixed ) {
428
- widths [i ].finalWidth = widths [i ].width * extraWidth / totalFlexible ;
431
+ widths [i ].finalWidth = totalFlexible > 0
432
+ ? widths [i ].width * extraWidth / totalFlexible
433
+ : extraWidth / flexibleCount ;
429
434
}
430
435
}
431
436
}
You can’t perform that action at this time.
0 commit comments