templates tested
This commit is contained in:
@@ -140,12 +140,20 @@ Multi-column layout with explicit column definitions. Each column is defined by
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `width` | int | _(auto)_ | Column width in characters. Unspecified columns share remaining space equally. |
|
||||
| `width` | int or string | _(auto)_ | Column width as a character count (`"10"`) or percentage of the row width (`"33.3%"`). Unspecified columns share remaining space equally. |
|
||||
| `align` | `left` / `center` / `right` | `left` | Text alignment within the column |
|
||||
| `wrap` | `true` / `false` | `false` | Word-wrap text that exceeds column width. All columns expand vertically to match the tallest cell. |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```xml
|
||||
<!-- Equal-width columns using percentages -->
|
||||
<row>
|
||||
<col width="33.3%" align="left">Name</col>
|
||||
<col width="33.3%" align="right">Qty</col>
|
||||
<col width="33.3%" align="right">Price</col>
|
||||
</row>
|
||||
|
||||
<!-- Tax breakdown header -->
|
||||
<row>
|
||||
<col width="10" align="left">MwSt %</col>
|
||||
@@ -161,10 +169,28 @@ Multi-column layout with explicit column definitions. Each column is defined by
|
||||
<col width="10" align="right">{{tax.Net:F2}} {{tax.Currency}}</col>
|
||||
<col align="right">{{tax.TaxAmount:F2}} {{tax.Currency}}</col>
|
||||
</row>
|
||||
|
||||
<!-- Row with word wrap on the first column -->
|
||||
<row>
|
||||
<col width="10" align="left" wrap="true">Very Long Product Name Here</col>
|
||||
<col align="right">12.50</col>
|
||||
</row>
|
||||
<!-- Output (42-char width, col2 auto-fills remaining 32 chars):
|
||||
Very Long 12.50
|
||||
Product
|
||||
Name Here -->
|
||||
|
||||
<!-- Both columns wrapping -->
|
||||
<row>
|
||||
<col width="20" align="left" wrap="true">{{item.Name}}</col>
|
||||
<col width="22" align="left" wrap="true">{{item.Description}}</col>
|
||||
</row>
|
||||
```
|
||||
|
||||
In this example, the first three columns are 10 characters wide. The fourth column gets all remaining space (`lineWidth - 30`).
|
||||
|
||||
When `wrap="true"` is set on a column, text that exceeds the column width wraps to multiple lines. All columns in the row expand vertically to match the tallest cell. Each wrapped line respects the column's `align` attribute.
|
||||
|
||||
---
|
||||
|
||||
### `<separator>`
|
||||
@@ -244,10 +270,11 @@ If `headerItems` is not set, the text content of `<col>` elements is used as the
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `width` | int | _(auto)_ | Column width in characters (excluding border characters) |
|
||||
| `width` | int or string | _(auto)_ | Column width as a character count (`"10"`) or percentage of the content area (`"50%"`). Percentages are relative to the content width (line width minus border characters). Unspecified columns share remaining space equally. |
|
||||
| `align` | `left` / `center` / `right` | `left` | Cell content alignment |
|
||||
| `wrap` | `true` / `false` | `false` | Word-wrap cell text that exceeds column width. All columns in the row expand vertically to match the tallest cell. |
|
||||
|
||||
Column widths exclude border characters. With 3 columns, 4 border characters (`|`) are used, so the available content width is `lineWidth - 4`.
|
||||
Column widths exclude border characters. With 3 columns, 4 border characters (`|`) are used, so the available content width is `lineWidth - 4`. Percentage widths are calculated against this content width.
|
||||
|
||||
**Examples:**
|
||||
|
||||
@@ -275,8 +302,24 @@ Column widths exclude border characters. With 3 columns, 4 border characters (`|
|
||||
|Margherita | 12.50|
|
||||
|Tiramisu | 8.00|
|
||||
+--------------------+----------+ -->
|
||||
|
||||
<!-- Table with word wrap -->
|
||||
<table items="Products" var="p">
|
||||
<col width="12" align="left" wrap="true">Name</col>
|
||||
<col width="8" align="right">Price</col>
|
||||
</table>
|
||||
<!-- Output (cell text wraps, all columns expand vertically):
|
||||
+------------+--------+
|
||||
|Name | Price|
|
||||
+------------+--------+
|
||||
|Margherita | 12.50|
|
||||
|Wiener | 8.00|
|
||||
|Schnitzel | |
|
||||
+------------+--------+ -->
|
||||
```
|
||||
|
||||
When `wrap="true"` is set on a table `<col>`, cell text that exceeds the column width wraps to multiple lines. All columns in the row expand vertically to match the tallest cell, with empty cells padded with spaces. Each wrapped line respects the column's `align` attribute.
|
||||
|
||||
---
|
||||
|
||||
## Control Flow
|
||||
@@ -632,7 +675,7 @@ Comment: Well done
|
||||
| `<receipt>` | _(root)_ | - |
|
||||
| `<line>` | 1 PrintCommand (or N if wrapping) | `align`, `bold`, `big`, `tall`, `red`, `wrap`, `wrapIndent`, `lineSpacing` |
|
||||
| `<columns>` | 1 PrintCommand (or N if wrapping) | `left`, `right`, `bold`, `big`, `tall`, `red`, `wrap`, `wrapIndent`, `lineSpacing` |
|
||||
| `<row>` | 1 PrintCommand | `bold`, `big`, `tall`, `red`, `lineSpacing` + nested `<col>` |
|
||||
| `<row>` | 1+ PrintCommand(s) (N if wrapping) | `bold`, `big`, `tall`, `red`, `lineSpacing` + nested `<col>` |
|
||||
| `<separator>` | 1 PrintCommand | `char` |
|
||||
| `<cut />` | 1 PrintCommand (IsCut=true) | - |
|
||||
| `<feed />` | N PrintCommands (empty lines) | `lines` |
|
||||
|
||||
Reference in New Issue
Block a user