Expand description
Table types: Table, TableRow, TableCell.
Tables in HWP documents are structural containers. Each cell holds
its own paragraphs (rich content, not just text). Cells can span
multiple columns or rows via col_span / row_span.
§Validation
Table validation is performed at the Document level (not by Table constructors) so that tables can be built incrementally. The validation rules are:
- At least 1 row
- Each row has at least 1 cell
- Each cell has at least 1 paragraph
col_span >= 1,row_span >= 1
§Examples
use hwpforge_core::table::{Table, TableRow, TableCell};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex, CharShapeIndex};
use hwpforge_core::run::Run;
let cell = TableCell::new(
vec![Paragraph::with_runs(
vec![Run::text("Hello", CharShapeIndex::new(0))],
ParaShapeIndex::new(0),
)],
HwpUnit::from_mm(50.0).unwrap(),
);
let row = TableRow::new(vec![cell]);
let table = Table::new(vec![row]);
assert_eq!(table.row_count(), 1);Structs§
- Table
- A table: a sequence of rows, with optional width and caption.
- Table
Cell - A single cell within a table row.
- Table
Margin - Explicit margins inside a table cell.
- Table
Row - A single row of a table.
Enums§
- Table
Page Break - Page-break policy for a table.
- Table
Vertical Align - Vertical alignment for content inside a table cell.