@@ -100,7 +100,8 @@ public class Table extends BlockElement<Table> implements ILargeElement {
100
100
*
101
101
* @param columnWidths preferable column widths in points. Values must be greater than or equal to zero,
102
102
* otherwise it will be interpreted as undefined.
103
- * @param largeTable whether parts of the table will be written before all data is added.
103
+ * @param largeTable whether parts of the table will be written before all data is added.
104
+ * Note, large table do not support auto layout. Table width must be specified.
104
105
* @see #setAutoLayout()
105
106
* @see #setFixedLayout()
106
107
*/
@@ -189,8 +190,8 @@ public Table(float[] pointColumnWidths) {
189
190
}
190
191
191
192
/**
192
- * Constructs a {@code Table} with number of columns. Each column will get equal percent width.
193
- * 100% table width set implicitly for backward compatibility.
193
+ * Constructs a {@code Table} with specified number of columns. Each column will get equal percent width,
194
+ * the final column widths depend on selected table layout. 100% table width set implicitly for backward compatibility.
194
195
* <br/>
195
196
* Since 7.0.2 table layout algorithms were introduced. Auto layout is default, except large tables.
196
197
* For large table fixed layout set implicitly.
@@ -203,6 +204,7 @@ public Table(float[] pointColumnWidths) {
203
204
*
204
205
* @param numColumns the number of columns, each column will have equal percent width.
205
206
* @param largeTable whether parts of the table will be written before all data is added.
207
+ * Note, large table do not support auto layout. Table width must be specified.
206
208
* @see #setAutoLayout()
207
209
* @see #setFixedLayout()
208
210
* @deprecated in 7.1 each column will have undefined width.
@@ -225,8 +227,8 @@ public Table(int numColumns, boolean largeTable) {
225
227
}
226
228
227
229
/**
228
- * Constructs a {@code Table} with number of columns. Each column will get equal percent width.
229
- * 100% table width set implicitly for backward compatibility.
230
+ * Constructs a {@code Table} with specified number of columns. Each column will get equal percent width,
231
+ * the final column widths depend on selected table layout. 100% table width set implicitly for backward compatibility.
230
232
* <br/>
231
233
* Since 7.0.2 table layout was introduced. Auto layout is default, except large tables.
232
234
* For large table fixed layout set implicitly.
@@ -291,12 +293,23 @@ private static UnitValue[] normalizeColumnWidths(int numberOfColumns) {
291
293
* <p/>
292
294
* Algorithm description
293
295
* <br/>
294
- * 1. Scan columns for width property and set it. (Columns have set in constructor, analog of {@code <colgroup>} element in HTML)<br/>
295
- * 2. Scan the very first row of table for width property and set it to undefined columns (cell width has lower priority in comparing with column).
296
- * If cell has colspan, each column will get equal width: {@code (width/colspan)}.<br/>
297
- * 3. If sum of columns is less, than table width, there are two options:<br/>
298
- * 3.1. If undefined columns still exist, they will get the rest remaining width.<br/>
299
- * 3.2. Otherwise all columns will be expanded proportionally based on its width.<br/>
296
+ * 1. Scan columns for width property and set it. All the rest columns get undefined value.
297
+ * Column width includes borders and paddings. Columns have set in constructor, analog of {@code <colgroup>} element in HTML.
298
+ * <br/>
299
+ * 2. Scan the very first row of table for width property and set it to undefined columns.
300
+ * Cell width has lower priority in comparing with column. Cell width doesn't include borders and paddings.
301
+ * <br/>
302
+ * 2.1 If cell has colspan and all columns are undefined, each column will get equal width: {@code width/colspan}.
303
+ * <br/>
304
+ * 2.2 If some columns already have width, equal remain width will be added {@code remainWidth/colspan} to each column.
305
+ * <br/>
306
+ * 3. If sum of columns is less, than table width, there are two options:
307
+ * <br/>
308
+ * 3.1. If undefined columns still exist, they will get the rest remaining width.
309
+ * <br/>
310
+ * 3.2. Otherwise all columns will be expanded proportionally based on its width.
311
+ * <br/>
312
+ * 4. If sum of columns is greater, than table width, nothing to do.
300
313
*
301
314
* @return this element.
302
315
*/
@@ -306,12 +319,23 @@ public Table setFixedLayout() {
306
319
}
307
320
308
321
/**
309
- * Set auto layout.
322
+ * Set auto layout. Analog of {@code table-layout:fixed} CSS property. <br />
323
+ * Note, large table does not support auto layout.
310
324
* <p/>
311
- * 1.
325
+ * Algorithm principles.
326
+ * <br/>
327
+ * 1. Column width cannot be less, than min-width of any cell in the column (calculated by layout).
328
+ * <br/>
329
+ * 2. Specified table width has higher priority, than sum of column and cell widths.
330
+ * <br/>
331
+ * 3. Percent value of cell and column width has higher priority, than point value.
332
+ * <br/>
333
+ * 4. Cell width has higher priority, than column width.
334
+ * <br/>
335
+ * 5. If column has no width, it will try to reach max-value (calculated by layout).
336
+ *
312
337
* @return this element.
313
338
*/
314
-
315
339
public Table setAutoLayout () {
316
340
setProperty (Property .TABLE_LAYOUT , "auto" );
317
341
return this ;
0 commit comments