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: SheetUidThe sheet’s identity while the app runs (SheetUid). Not in JSON or the file.
file_id: u32The 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: f32Default 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: boolThe outline’s level buttons and brackets (Excel’s Show Outline Symbols, Ctrl+8); the outline itself stays.
summary_below: boolOutline 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: CellRefLast selection and scroll position, saved with the file.
view_top_left: CellRef§view: SheetViewModeNormal, 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
impl Sheet
pub fn new(name: impl Into<String>) -> Sheet
pub fn cell(&self, c: CellRef) -> Option<&Cell>
Sourcepub fn spill_anchor(&self, c: CellRef) -> Option<CellRef>
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.
Sourcepub fn clear_spill(&mut self, r: RangeRef)
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.
Sourcepub fn settle_spill(&mut self, anchor: CellRef)
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.
Sourcepub fn object_ref(&self, id: u32) -> Option<ObjRef>
pub fn object_ref(&self, id: u32) -> Option<ObjRef>
The floating object with workbook-unique id id on this sheet.
Sourcepub fn has_object(&self, o: ObjRef) -> bool
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.
Sourcepub fn object_anchor(&self, o: ObjRef) -> Option<Anchor>
pub fn object_anchor(&self, o: ObjRef) -> Option<Anchor>
The anchor of the floating object o.
pub fn object_anchor_mut(&mut self, o: ObjRef) -> Option<&mut Anchor>
Sourcepub fn remove_object(&mut self, o: ObjRef) -> bool
pub fn remove_object(&mut self, o: ObjRef) -> bool
Removes the floating object o; false when there is no such object.
Sourcepub fn object_anchors(&self) -> impl Iterator<Item = &Anchor>
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.
pub fn object_anchors_mut(&mut self) -> impl Iterator<Item = &mut Anchor>
Sourcepub fn value(&self, c: CellRef) -> Value
pub fn value(&self, c: CellRef) -> Value
Displayed value of a cell: its own value, or a spilled value.
pub fn value_ref(&self, c: CellRef) -> Option<&Value>
Sourcepub fn last_contiguous_nonempty(&self, col: u32, from_row: u32, cap: u32) -> u32
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.
pub fn style_id(&self, c: CellRef) -> StyleId
pub fn set_value(&mut self, c: CellRef, v: Value)
Sourcepub fn set_cell(&mut self, c: CellRef, cell: Cell)
pub fn set_cell(&mut self, c: CellRef, cell: Cell)
Replaces content, removing any picture at this address. Style-only edits use set_style.
pub fn remove_cell(&mut self, c: CellRef) -> Option<Cell>
Sourcepub fn take_cells(&mut self, range: RangeRef) -> Vec<(CellRef, Cell)>
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.
Sourcepub fn set_picture(&mut self, c: CellRef, picture: Arc<CellPicture>)
pub fn set_picture(&mut self, c: CellRef, picture: Arc<CellPicture>)
Pictures retain a scalar fallback for calculation and unsupported consumers.
pub fn input_text(&self, c: CellRef) -> String
pub fn set_style(&mut self, c: CellRef, style: StyleId)
Whether this cell has a table or ordinary AutoFilter dropdown.
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.
pub fn col_width(&self, col: u32) -> f32
pub fn row_height(&self, row: u32) -> f32
Sourcepub fn is_row_filtered(&self, row: u32) -> bool
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.