pub struct HeaderBuilder {
pub levels: Vec<Vec<HeaderCell>>,
pub total_columns: usize,
pub default_style: CellStyle,
}Expand description
Builder for creating complex multi-level table headers
Fields§
§levels: Vec<Vec<HeaderCell>>All header cells organized by levels
total_columns: usizeTotal number of columns in the table
default_style: CellStyleDefault style for headers
Implementations§
Source§impl HeaderBuilder
impl HeaderBuilder
Sourcepub fn auto() -> Self
pub fn auto() -> Self
Create a new header builder without specifying columns (for compatibility with tests)
Sourcepub fn add_level(self, headers: Vec<(&str, usize)>) -> Self
pub fn add_level(self, headers: Vec<(&str, usize)>) -> Self
Add a header level with (text, colspan) pairs
Sourcepub fn default_style(self, style: CellStyle) -> Self
pub fn default_style(self, style: CellStyle) -> Self
Set default header style
Sourcepub fn add_simple_row(self, headers: Vec<&str>) -> Self
pub fn add_simple_row(self, headers: Vec<&str>) -> Self
Add a simple single-level header row
Sourcepub fn add_custom_row(self, cells: Vec<HeaderCell>) -> Self
pub fn add_custom_row(self, cells: Vec<HeaderCell>) -> Self
Add a header row with custom cells
Sourcepub fn add_group(self, group_header: &str, sub_headers: Vec<&str>) -> Self
pub fn add_group(self, group_header: &str, sub_headers: Vec<&str>) -> Self
Add a grouped header (spans multiple columns) with sub-headers
Example: “Sales Data” spanning 3 columns with sub-headers “Q1”, “Q2”, “Q3”
Sourcepub fn add_complex_header(
self,
text: &str,
start_col: usize,
colspan: usize,
rowspan: usize,
) -> Self
pub fn add_complex_header( self, text: &str, start_col: usize, colspan: usize, rowspan: usize, ) -> Self
Add a complex header structure with manual positioning
Sourcepub fn calculate_height(&self) -> f64
pub fn calculate_height(&self) -> f64
Get the height needed for headers (in points, assuming default font size)
Sourcepub fn validate(&self) -> Result<(), TableError>
pub fn validate(&self) -> Result<(), TableError>
Validate the header structure
Sourcepub fn get_cells_at_position(
&self,
level: usize,
col: usize,
) -> Vec<&HeaderCell>
pub fn get_cells_at_position( &self, level: usize, col: usize, ) -> Vec<&HeaderCell>
Get all cells that should be rendered at a specific position
Sourcepub fn financial_report() -> Self
pub fn financial_report() -> Self
Create a financial report header
Sourcepub fn product_comparison(products: Vec<&str>) -> Self
pub fn product_comparison(products: Vec<&str>) -> Self
Create a product comparison header
Trait Implementations§
Source§impl Clone for HeaderBuilder
impl Clone for HeaderBuilder
Source§fn clone(&self) -> HeaderBuilder
fn clone(&self) -> HeaderBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more