pub struct Table {
pub properties: Option<RawXmlNode>,
pub grid: Vec<GridColumn>,
pub rows: Vec<TableRow>,
pub unknown_children: Vec<RawXmlNode>,
}Expand description
Table element (w:tbl)
Fields§
§properties: Option<RawXmlNode>Table properties
grid: Vec<GridColumn>Table grid
rows: Vec<TableRow>Table rows
unknown_children: Vec<RawXmlNode>Unknown children (preserved)
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(rows: usize, cols: usize) -> Self
pub fn new(rows: usize, cols: usize) -> Self
Create a new table with the specified number of rows and columns
Sourcepub fn from_data<S: Into<String> + Clone>(data: &[&[S]]) -> Self
pub fn from_data<S: Into<String> + Clone>(data: &[&[S]]) -> Self
Create a table from a 2D array of strings
Sourcepub fn from_reader<R: BufRead>(
reader: &mut Reader<R>,
_start: &BytesStart<'_>,
) -> Result<Self>
pub fn from_reader<R: BufRead>( reader: &mut Reader<R>, _start: &BytesStart<'_>, ) -> Result<Self>
Parse from reader (after w:tbl start tag)
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get column count (based on first row)
Sourcepub fn cell_mut(&mut self, row: usize, col: usize) -> Option<&mut TableCell>
pub fn cell_mut(&mut self, row: usize, col: usize) -> Option<&mut TableCell>
Get mutable cell at position
Sourcepub fn set_cell_text(&mut self, row: usize, col: usize, text: impl Into<String>)
pub fn set_cell_text(&mut self, row: usize, col: usize, text: impl Into<String>)
Set cell text at position
Sourcepub fn set_column_width(&mut self, col: usize, width: i32)
pub fn set_column_width(&mut self, col: usize, width: i32)
Set column width (in twips, 1/20 of a point)
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 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
Mutably borrows from an owned value. Read more