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 { cells: vec![cell], height: None };
let table = Table::new(vec![row]);
assert_eq!(table.row_count(), 1);