#[non_exhaustive]pub struct Table {
pub rows: Vec<TableRow>,
pub width: Option<HwpUnit>,
pub caption: Option<Caption>,
pub page_break: TablePageBreak,
pub repeat_header: bool,
pub cell_spacing: Option<HwpUnit>,
pub border_fill_id: Option<u32>,
pub inst_id: Option<ObjectId>,
}Expand description
A table: a sequence of rows, with optional width and caption.
§Design Decision
No border: Option<BorderStyle> in Phase 1. Border styling is a
Blueprint concern (Phase 2). Core tables are purely structural.
§Examples
use hwpforge_core::table::{Table, TableCell, TablePageBreak, TableRow};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let table = Table::new(vec![TableRow::new(vec![TableCell::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(100.0).unwrap(),
)])])
.with_page_break(TablePageBreak::Cell);
assert_eq!(table.row_count(), 1);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.rows: Vec<TableRow>Rows of the table.
width: Option<HwpUnit>Optional explicit table width. None means auto-width.
caption: Option<Caption>Optional table caption.
page_break: TablePageBreakPage-break policy for this table.
repeat_header: boolWhether the first row repeats across page breaks.
cell_spacing: Option<HwpUnit>Optional explicit spacing between table cells.
border_fill_id: Option<u32>Optional table-level border/fill reference.
inst_id: Option<ObjectId>Wave 12p Step 2b: instance ID for cross-ref target lookup. HWP5
변환 시 Table CtrlHeader trailer 의 instance ID 가 채워지고,
HWPX encoder 가 <hp:tbl id="..."> attribute 로 emit. None
이면 encoder 가 fallback 값 (예: sequential counter) 사용 허용.
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(rows: Vec<TableRow>) -> Self
pub fn new(rows: Vec<TableRow>) -> Self
Creates a table from rows.
§Examples
use hwpforge_core::table::{Table, TableRow};
let table = Table::new(vec![TableRow::new(vec![])]);
assert_eq!(table.row_count(), 1);Sourcepub fn with_width(self, width: HwpUnit) -> Self
pub fn with_width(self, width: HwpUnit) -> Self
Sets an explicit table width.
Sourcepub fn with_caption(self, caption: Caption) -> Self
pub fn with_caption(self, caption: Caption) -> Self
Attaches a table caption.
Sourcepub fn with_page_break(self, page_break: TablePageBreak) -> Self
pub fn with_page_break(self, page_break: TablePageBreak) -> Self
Sets the page-break policy for this table.
Sourcepub fn with_repeat_header(self, repeat_header: bool) -> Self
pub fn with_repeat_header(self, repeat_header: bool) -> Self
Controls whether the leading header block repeats across page breaks.
Sourcepub fn with_cell_spacing(self, cell_spacing: HwpUnit) -> Self
pub fn with_cell_spacing(self, cell_spacing: HwpUnit) -> Self
Sets the explicit spacing between cells.
Sourcepub fn with_border_fill_id(self, border_fill_id: u32) -> Self
pub fn with_border_fill_id(self, border_fill_id: u32) -> Self
Sets the table-level border/fill reference.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Table
impl<'de> Deserialize<'de> for Table
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Table
impl JsonSchema for Table
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more