Skip to main content

Sheet

Struct Sheet 

Source
pub struct Sheet {
Show 44 fields pub name: String, pub uid: SheetUid, pub file_id: u32, pub cells: CellStore, pub cell_pictures: BTreeMap<CellRef, Arc<CellPicture>>, pub spill: BTreeMap<CellRef, Value>, pub spill_ranges: BTreeMap<CellRef, RangeRef>, pub cols: BTreeMap<u32, LineInfo>, pub rows: BTreeMap<u32, LineInfo>, pub default_col_width: f32, pub default_row_height: f32, pub merges: Vec<RangeRef>, pub freeze: Option<(u32, u32)>, pub tab_color: Option<Color>, pub visibility: Visibility, pub show_gridlines: bool, pub show_headings: bool, pub show_formulas: bool, pub show_zeros: bool, pub show_outline_symbols: bool, pub summary_below: bool, pub summary_right: bool, pub right_to_left: bool, pub zoom: u16, pub cond_formats: Vec<CondFormat>, pub validations: Vec<Validation>, pub tables: Vec<Table>, pub autofilter: Option<AutoFilter>, pub comments: BTreeMap<CellRef, Comment>, pub hyperlinks: BTreeMap<CellRef, Hyperlink>, pub charts: Vec<Chart>, pub images: Vec<Image>, pub shapes: Vec<Shape>, pub sparklines: Vec<Sparkline>, pub slicers: Vec<Slicer>, pub controls: Vec<FormControl>, pub pivots: Vec<PivotTable>, pub protection: Option<SheetProtection>, pub edit_ranges: Vec<EditRange>, pub print: PrintSettings, pub view_active: CellRef, pub view_top_left: CellRef, pub view: SheetViewMode, pub preserved: Option<Arc<Preserved>>,
}

Fields§

§name: String§uid: SheetUid

The sheet’s identity while the app runs (SheetUid). Not in JSON or the file.

§file_id: u32

The sheetId the file gave the sheet, written back on save so that what refers to the sheet by its id keeps finding it; 0 for a sheet the file did not have. Not in JSON.

§cells: CellStore§cell_pictures: BTreeMap<CellRef, Arc<CellPicture>>

Static pictures are sparse rich content. Ordinary cells carry no picture pointer.

§spill: BTreeMap<CellRef, Value>

Values spilled by dynamic-array formulas (maintained by calc), keyed by cell.

§spill_ranges: BTreeMap<CellRef, RangeRef>

Anchor → spill range.

§cols: BTreeMap<u32, LineInfo>§rows: BTreeMap<u32, LineInfo>§default_col_width: f32

Default column width and row height in pixels at 96 dpi (a file stores row heights in points).

§default_row_height: f32§merges: Vec<RangeRef>§freeze: Option<(u32, u32)>

Frozen rows and columns (top/left).

§tab_color: Option<Color>§visibility: Visibility§show_gridlines: bool§show_headings: bool§show_formulas: bool§show_zeros: bool§show_outline_symbols: bool

The outline’s level buttons and brackets (Excel’s Show Outline Symbols, Ctrl+8); the outline itself stays.

§summary_below: bool

Outline summary rows sit below their detail, and summary columns right of it (Data ▸ Outline ▸ Settings; off puts them above / left). Saved as outlinePr summaryBelow and summaryRight.

§summary_right: bool§right_to_left: bool§zoom: u16§cond_formats: Vec<CondFormat>§validations: Vec<Validation>§tables: Vec<Table>§autofilter: Option<AutoFilter>§comments: BTreeMap<CellRef, Comment>§hyperlinks: BTreeMap<CellRef, Hyperlink>§charts: Vec<Chart>§images: Vec<Image>§shapes: Vec<Shape>§sparklines: Vec<Sparkline>§slicers: Vec<Slicer>

On-sheet slicer widgets (filter a table column by clicking value tiles).

§controls: Vec<FormControl>

Form controls (buttons, sliders, spin buttons). They paint above every other object and take clicks first.

§pivots: Vec<PivotTable>

PivotTables whose output lives on this sheet.

§protection: Option<SheetProtection>§edit_ranges: Vec<EditRange>

Allow Edit Ranges (meaningful while the sheet is protected).

§print: PrintSettings§view_active: CellRef

Last selection and scroll position, saved with the file.

§view_top_left: CellRef§view: SheetViewMode

Normal, Page Layout or Page Break Preview.

§preserved: Option<Arc<Preserved>>

Unmodelled file content of this sheet kept for saving (form controls, OLE objects, query tables). Goes away with the sheet; not in JSON.

Implementations§

Source§

impl Sheet

Source

pub fn new(name: impl Into<String>) -> Sheet

Source

pub fn cell(&self, c: CellRef) -> Option<&Cell>

Source

pub fn spill_anchor(&self, c: CellRef) -> Option<CellRef>

The source of a non-anchor dynamic-array spill cell, from the current calc state. Anchors, ordinary cells and cells outside successfully generated spills return None.

Source

pub fn clear_spill(&mut self, r: RangeRef)

Removes the spilled values inside r. The work is bounded by the values stored, not by the size of r, so a range from a file that claims the whole sheet costs no more than the values it holds.

Source

pub fn settle_spill(&mut self, anchor: CellRef)

Turns the spill anchored at anchor into plain values, for a Python cell that keeps only its value: the range is forgotten, and each spilled value in it becomes its cell’s value, unless the cell holds content of its own (its format is kept either way). The work is bounded by the spilled values stored, not by the size of the range.

Source

pub fn object_ref(&self, id: u32) -> Option<ObjRef>

The floating object with workbook-unique id id on this sheet.

Source

pub fn has_object(&self, o: ObjRef) -> bool

Whether the floating object o exists on this sheet. Shape accepts any shape (an equation included); Equation only an equation.

Source

pub fn object_anchor(&self, o: ObjRef) -> Option<Anchor>

The anchor of the floating object o.

Source

pub fn object_anchor_mut(&mut self, o: ObjRef) -> Option<&mut Anchor>

Source

pub fn remove_object(&mut self, o: ObjRef) -> bool

Removes the floating object o; false when there is no such object.

Source

pub fn object_anchors(&self) -> impl Iterator<Item = &Anchor>

Every floating object’s anchor in a fixed order (charts, images, shapes, slicers, controls) that Sheet::object_anchors_mut repeats, so a pass can compute new anchors from the old ones and write them back in step.

Source

pub fn object_anchors_mut(&mut self) -> impl Iterator<Item = &mut Anchor>

Source

pub fn value(&self, c: CellRef) -> Value

Displayed value of a cell: its own value, or a spilled value.

Source

pub fn value_ref(&self, c: CellRef) -> Option<&Value>

Source

pub fn last_contiguous_nonempty(&self, col: u32, from_row: u32, cap: u32) -> u32

Last row (inclusive) of the maximal contiguous run of non-empty values in col, starting at from_row and capped at cap (inclusive). from_row - 1 when from_row itself is empty (or from_row > cap), same as a cell-by-cell value_ref scan would find, but without calling value_ref once per row: CellStore::contiguous_value_run walks each band’s row map directly for the common case (a run of stored cells), only falling back to a per-row value_ref check where the stored run stops short of cap. Used by the fill-handle double-click, where col can be densely populated for very long stretches.

Source

pub fn style_id(&self, c: CellRef) -> StyleId

Source

pub fn set_value(&mut self, c: CellRef, v: Value)

Source

pub fn set_cell(&mut self, c: CellRef, cell: Cell)

Replaces content, removing any picture at this address. Style-only edits use set_style.

Source

pub fn remove_cell(&mut self, c: CellRef) -> Option<Cell>

Source

pub fn take_cells(&mut self, range: RangeRef) -> Vec<(CellRef, Cell)>

Removes content in a range; returns scalar cells, with pictures removed from the side map.

Source

pub fn set_picture(&mut self, c: CellRef, picture: Arc<CellPicture>)

Pictures retain a scalar fallback for calculation and unsupported consumers.

Source

pub fn input_text(&self, c: CellRef) -> String

Source

pub fn set_style(&mut self, c: CellRef, style: StyleId)

Source

pub fn has_filter_button(&self, c: CellRef) -> bool

Whether this cell has a table or ordinary AutoFilter dropdown.

Source

pub fn filter_button_space(&self, c: CellRef) -> f32

Horizontal header space in unzoomed grid units (96 units per inch). Observed in Windows Excel 16.0 build 20326: AutoFit reserves 12.5 pt at 100-200% zoom, 25 pt at 50%, regardless of header row height. Below 100% the dropdown keeps its screen width. This is geometry, not font padding.

Source

pub fn col_width(&self, col: u32) -> f32

Source

pub fn row_height(&self, row: u32) -> f32

Source

pub fn is_row_hidden(&self, row: u32) -> bool

Source

pub fn is_row_filtered(&self, row: u32) -> bool

Whether row is hidden by an applied filter: a hidden row below the header of the sheet AutoFilter while it has criteria, or a hidden data row of a filtered table. Other hidden rows were hidden by hand.

Source

pub fn is_col_hidden(&self, col: u32) -> bool

Source

pub fn row_top(&self, row: u32) -> f64

Y offset (points) of the top of row.

Source

pub fn col_left(&self, col: u32) -> f64

Source

pub fn row_at(&self, y: f64) -> u32

Row containing y (points from the top), clamped.

Source

pub fn col_at(&self, x: f64) -> u32

Source

pub fn merge_at(&self, c: CellRef) -> Option<RangeRef>

The merged range containing c, if any.

Source

pub fn table_at(&self, c: CellRef) -> Option<&Table>

Source

pub fn used_range(&self) -> Option<RangeRef>

Source

pub fn is_protected(&self) -> bool

Trait Implementations§

Source§

impl Clone for Sheet

Source§

fn clone(&self) -> Sheet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Sheet

Source§

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

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

impl<'de> Deserialize<'de> for Sheet

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 PartialEq for Sheet

Source§

fn eq(&self, other: &Sheet) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Sheet

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 StructuralPartialEq for Sheet

Auto Trait Implementations§

§

impl Freeze for Sheet

§

impl RefUnwindSafe for Sheet

§

impl Send for Sheet

§

impl Sync for Sheet

§

impl Unpin for Sheet

§

impl UnsafeUnpin for Sheet

§

impl UnwindSafe for Sheet

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.