Skip to main content

TableCell

Struct TableCell 

Source
pub struct TableCell {
    pub id: Option<STString>,
    pub cell_properties: Option<Box<TableCellProperties>>,
    pub block_content: Vec<BlockContent>,
    pub extra_attrs: HashMap<String, String>,
    pub extra_children: Vec<PositionedNode>,
}

Fields§

§id: Option<STString>§cell_properties: Option<Box<TableCellProperties>>§block_content: Vec<BlockContent>§extra_attrs: HashMap<String, String>

Unknown attributes captured for roundtrip fidelity.

§extra_children: Vec<PositionedNode>

Unknown child elements captured for roundtrip fidelity.

Implementations§

Source§

impl TableCell

Source

pub fn add_paragraph(&mut self) -> &mut Paragraph

Add a paragraph and return a mutable reference.

Source

pub fn set_grid_span(&mut self, n: u32)

Set the grid span (number of columns this cell spans).

Maps to <w:gridSpan w:val="n"/> in cell properties. ECMA-376 Part 1, Section 17.4.17 (w:gridSpan).

Source

pub fn set_vertical_merge(&mut self, merge_type: VMergeType)

Set vertical merge on this cell.

  • VMergeType::Restart<w:vMerge w:val="restart"/> (starts a merged region)
  • VMergeType::Continue<w:vMerge/> (continues a merged region)

ECMA-376 Part 1, Section 17.4.84 (w:vMerge).

Source§

impl TableCell

Source

pub fn set_background_color(&mut self, rgb: &str)

Set the background (shading) color of this cell.

The rgb value should be a hex string (e.g., "FF0000" for red, "auto" for automatic). Maps to <w:tcPr><w:shd w:val="clear" w:fill="..." w:color="auto"/></w:tcPr>. ECMA-376 Part 1, Section 17.4.32 (w:shd).

Source

pub fn set_borders( &mut self, style: BorderStyle, width_eights: u32, color: &str, )

Set all four borders of this cell at once.

style is the border style, width_eights is the width in eighths of a point (e.g., 4 = half a point = 0.5pt), and color is a hex color string (e.g., "000000").

ECMA-376 Part 1, Section 17.4.5 (w:tcBorders).

Source

pub fn set_border_top( &mut self, style: BorderStyle, width_eights: u32, color: &str, )

Set the top border of this cell.

ECMA-376 Part 1, Section 17.4.5 (w:tcBorders).

Source

pub fn set_border_bottom( &mut self, style: BorderStyle, width_eights: u32, color: &str, )

Set the bottom border of this cell.

ECMA-376 Part 1, Section 17.4.5 (w:tcBorders).

Source

pub fn set_border_left( &mut self, style: BorderStyle, width_eights: u32, color: &str, )

Set the left border of this cell.

ECMA-376 Part 1, Section 17.4.5 (w:tcBorders).

Source

pub fn set_border_right( &mut self, style: BorderStyle, width_eights: u32, color: &str, )

Set the right border of this cell.

ECMA-376 Part 1, Section 17.4.5 (w:tcBorders).

Source

pub fn set_padding(&mut self, top: u32, bottom: u32, left: u32, right: u32)

Set cell padding (margins) in twips.

Maps to <w:tcPr><w:tcMar .../></w:tcPr>. ECMA-376 Part 1, Section 17.4.44 (w:tcMar).

Trait Implementations§

Source§

impl CellExt for TableCell

Source§

fn paragraphs(&self) -> Vec<&Paragraph>

Get all paragraphs in this cell.
Source§

fn properties(&self) -> Option<&TableCellProperties>

Get cell properties.
Source§

fn text(&self) -> String

Extract all text from the cell.
Source§

impl Clone for TableCell

Source§

fn clone(&self) -> TableCell

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableCell

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableCell

Source§

fn default() -> TableCell

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TableCell

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromXml for TableCell

Source§

fn from_xml<R: BufRead>( reader: &mut Reader<R>, start_tag: &BytesStart<'_>, is_empty: bool, ) -> Result<Self, ParseError>

Parse from an XML reader positioned at the start tag. Read more
Source§

impl Serialize for TableCell

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToXml for TableCell

Source§

fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>

Write attributes onto the start tag and return it.
Source§

fn write_children<W: Write>( &self, writer: &mut Writer<W>, ) -> Result<(), SerializeError>

Write child elements and text content inside the element.
Source§

fn is_empty_element(&self) -> bool

Whether this element has no children (self-closing).
Source§

fn write_element<W>( &self, tag: &str, writer: &mut Writer<W>, ) -> Result<(), SerializeError>
where W: Write,

Write a complete element: <tag attrs>children</tag> or <tag attrs/>.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,