Tables
Tables support multi-page row splitting, repeating header rows across page breaks, merged and split cells, drag-to-resize columns, banded styling, cell padding/borders, and floating placement. Every cell owns a full nested document story.
- Included in:
notesConfiguration,documentConfiguration(or compose ontoDocumentExtension.richTextwithTableDocumentExtension) - Pure-Dart import:
package:vyuh_document_elements/table.dartorpackage:vyuh_document_elements/vyuh_document_elements.dart - Flutter extension:
TableDocumentExtension(bundled inDocumentEditorElements.defaults) - Action namespace:
TableActions
Quick example
dart
import 'package:vyuh_document/vyuh_document.dart';
import 'package:vyuh_document_elements/vyuh_document_elements.dart';
final doc = Document.of(notesConfiguration, [
Table.grid(
rows: [
Row([Cell.text('Metric'), Cell.text('Q3'), Cell.text('Q4')]),
Row([Cell.text('Revenue'), Cell.text('\$1.2M'), Cell.text('\$1.6M')]),
],
),
]);What you can configure
Table-level (TableBlock & TableFormat)
| Property | Type / Values | Purpose |
|---|---|---|
columnWidths, columnWidthBasis | List<double>, width basis | Fixed-point or proportional column widths; updated live by dragging column borders |
headerRowCount | int | Number of leading rows styled as headers and repeated automatically on continuation pages |
format.preferredWidth, layoutPolicy | double?, TableLayoutPolicy | Auto-fit vs. fixed table layout policy |
format.alignment, indent | Table alignment & indent | Left, center, or right table placement within the page column |
format.backgroundColor, border, defaultCellPadding | Hex color, border edges, padding | Table-wide fill, outer/inner grid borders, and default cell insets |
styleOptions | Banded rows, banded columns, first/last row, first/last column | Conditional region styling presets (mirrors Word table style flags) |
floatingAnchor, floatingGeometry | Floating table anchor | Optional text-wrapping table placement on paginated pages |
Cell & row level
| Property | Type / Values | Purpose |
|---|---|---|
TableCellFormat | Background color, per-edge borders, padding, VerticalCellAlign (top, center, bottom) | Per-cell visual styling and vertical alignment |
CellRange | Row/column span | Rectangular multi-cell selection, merge (MergeCells), and split |
| Row pagination | allowSplitAcrossPages / header repeat | Keep a row intact on one page or allow tall rows to break cleanly |
Actions & commands
| Action ID | Effect |
|---|---|
TableActions.insert | Insert a new table grid |
TableActions.addRowAbove, TableActions.addRow, TableActions.deleteRow | Insert or delete table rows |
TableActions.addColumnLeft, TableActions.addColumn, TableActions.deleteColumn | Insert or delete table columns |
TableActions.mergeCells, TableActions.splitCell | Merge a CellRange or split a merged cell |
TableActions.headerRow | Toggle repeating header row styling |
TableActions.moveRowUp, TableActions.moveRowDown, TableActions.moveColumnLeft, TableActions.moveColumnRight | Reorder rows and columns |
TableActions.selectCell, selectRow, selectColumn, selectTable, deleteTable | Structural selection and deletion |
- Typed commands:
InsertRow,RemoveRow,InsertColumn,MergeCells.
Restricting usage
- Remove tables:
notesConfiguration.withoutElements([Table.element]) - Disallow cell merging or table deletion: Gate
TableActions.mergeCellsorTableActions.deleteTableviaDocumentPolicyso templates keep a fixed grid structure.
Format parity
| DOCX | HTML | Markdown | |
|---|---|---|---|
Full <w:tbl> round-trip (grid, spans, repeating headers, borders, shading, floating tables) | Multi-page split tables with repeated headers & exact cell geometry | <table> with <thead>, colspan/rowspan, inline styles | GFM pipe tables |