Skip to main content

Cell

Struct Cell 

Source
pub struct Cell<'a> {
    pub element: &'a Element,
    pub covered: bool,
}
Expand description

One cell, as found in the tree.

Fields§

§element: &'a Element

The table:table-cell element, so that anything not modelled here is still reachable.

§covered: bool

True when this is a table:covered-table-cell: a cell hidden underneath a neighbour’s span. It is kept rather than skipped because the grid has to know not to draw a border there.

Implementations§

Source§

impl Cell<'_>

Source

pub fn value(&self) -> Value

The cell’s typed value.

Source

pub fn text(&self) -> String

What the cell shows: the text the producing application formatted and stored in the cell’s paragraphs.

This is why a viewer needs neither a number-format engine nor a formula evaluator. ODF requires a cell to carry both its typed value and the text of that value as the document was last displayed, so the formatted string — thousands separators, currency symbol, date order, decimal places — is already in the file. A cell edited here would have to be re-formatted from its data style, which is the work an editor adds and a viewer does not.

A cell with more than one paragraph gives them separated by newlines.

Source

pub fn formula(&self) -> Option<&str>

The formula, without the namespace prefix ODF writes in front of it.

A formula is written of:=SUM([.A1:.A9]), where the part before the colon says which formula language it is in. The prefix is dropped here and the expression given as it stands: nothing in this release evaluates one, and a formula bar shows what the document says.

Source

pub fn style_name(&self) -> Option<&str>

The cell style the cell names, if it names one.

Source

pub fn columns_spanned(&self) -> usize

How many columns the cell spans, which is one unless it says otherwise.

Source

pub fn rows_spanned(&self) -> usize

How many rows the cell spans.

Auto Trait Implementations§

§

impl<'a> Freeze for Cell<'a>

§

impl<'a> RefUnwindSafe for Cell<'a>

§

impl<'a> Send for Cell<'a>

§

impl<'a> Sync for Cell<'a>

§

impl<'a> Unpin for Cell<'a>

§

impl<'a> UnsafeUnpin for Cell<'a>

§

impl<'a> UnwindSafe for Cell<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.