pub struct Table {
pub rows: Vec<Row>,
pub style: TableStyle,
pub column_widths: Option<Vec<ColumnWidth>>,
pub total_width: Option<f32>,
pub header_rows: usize,
pub font_metrics: Option<Arc<dyn FontMetrics>>,
pub bold_font_metrics: Option<Arc<dyn FontMetrics>>,
}Expand description
Represents a table with rows and styling
Fields§
§rows: Vec<Row>§style: TableStyle§column_widths: Option<Vec<ColumnWidth>>Column width specifications
total_width: Option<f32>Total table width (if None, auto-calculate based on content)
header_rows: usizeNumber of header rows to repeat on each page when paginating
font_metrics: Option<Arc<dyn FontMetrics>>Font metrics for accurate text measurement and Unicode encoding. When set, enables font-aware text wrapping and glyph ID encoding.
bold_font_metrics: Option<Arc<dyn FontMetrics>>Bold font metrics for accurate bold text measurement and Unicode encoding. When set, bold cells can use a dedicated embedded bold font.
Implementations§
Source§impl Table
impl Table
Sourcepub fn with_style(self, style: TableStyle) -> Self
pub fn with_style(self, style: TableStyle) -> Self
Set the table style
Sourcepub fn with_column_widths(self, widths: Vec<ColumnWidth>) -> Self
pub fn with_column_widths(self, widths: Vec<ColumnWidth>) -> Self
Set column width specifications
Sourcepub fn with_total_width(self, width: f32) -> Self
pub fn with_total_width(self, width: f32) -> Self
Set total table width
Sourcepub fn with_pixel_widths(self, widths: Vec<f32>) -> Self
pub fn with_pixel_widths(self, widths: Vec<f32>) -> Self
Convenience method to set pixel widths for all columns
Sourcepub fn with_border(self, width: f32) -> Self
pub fn with_border(self, width: f32) -> Self
Set border width for the entire table
Sourcepub fn with_header_rows(self, count: usize) -> Self
pub fn with_header_rows(self, count: usize) -> Self
Set the number of header rows to repeat on each page
Sourcepub fn with_font_metrics(self, metrics: impl FontMetrics + 'static) -> Self
pub fn with_font_metrics(self, metrics: impl FontMetrics + 'static) -> Self
Set font metrics for accurate text measurement and Unicode encoding.
When font metrics are provided along with embedded_font_resource_name
on the table style, text will be encoded as glyph IDs and measured
using the actual font data instead of heuristic estimates.
Sourcepub fn with_bold_font_metrics(self, metrics: impl FontMetrics + 'static) -> Self
pub fn with_bold_font_metrics(self, metrics: impl FontMetrics + 'static) -> Self
Set bold font metrics for accurate bold text measurement and Unicode encoding.
When font metrics are provided along with embedded_font_resource_name_bold
on the table style, bold cell text will be encoded as glyph IDs and measured
using the bold font data.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get the number of columns (based on the first row, accounting for colspan)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl !RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl !UnwindSafe for Table
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().