Skip to main content

Module excel

Module excel 

Source
Expand description

Everything from excel_ooxml — reading and writing .xlsx.

Structs§

AutoFilterColumn
One column’s filter criteria within a Sheet::auto_filter_range (<filterColumn>/<filters>/<filter>, CT_FilterColumn/ CT_Filters/CT_Filter). Only the simplest, most common filter form is modeled: a fixed list of checked/visible values — CT_Filters’s CT_CustomFilters (e.g. “greater than”), CT_Top10, CT_DynamicFilter (e.g. “this month”), and CT_ColorFilter/CT_IconFilter forms are not.
Border
A cell’s borders (<border>, CT_Border) — up to four edges plus an optional diagonal. Border::default() (every field None/false) draws no border at all.
BorderEdge
One edge of a Border (<left>/<right>/<top>/<bottom>/ <diagonal>, CT_BorderPr): a line style plus an optional color.
CalculationProperties
Workbook-wide calculation properties (<calcPr>, CT_CalcPr). This crate never evaluates formulas itself (see CellValue::Formula’s doc comment) — these settings are pure storage, telling Excel how to recalculate once the file is opened, same “storage, not evaluation” posture as a formula’s own text.
Cell
A single cell (<c>, CT_Cell): a value plus an optional style.
CellAnchorPoint
One corner of a cell-anchored drawing range (<xdr:from>/<xdr:to>, CT_Marker) — a cell reference (0-based column/row, matching this crate’s own 0-based Row/column conventions elsewhere) plus an EMU offset within that cell, letting a picture/chart start or end partway through a cell rather than exactly on a gridline.
CellComment
A comment attached to a cell (legacy xl/comments*.xml + VML drawing, CT_Comment). Only plain-text comments with a fixed author are modeled — CT_Comment’s rich-text (CT_RElt runs) body and threaded-comment reply chains (CT_ThreadedComment, the modern Excel 365 “@mention” comment form) are out of scope.
CellFormat
A cell’s style: a number format, basic font attributes (bold/italic/size/color), a solid background fill color, borders, and horizontal/vertical alignment.
CellHyperlink
A per-cell hyperlink (<hyperlink>, CT_Hyperlink).
ColorScaleStop
A ConditionalFormattingCondition::ColorScale stop: a threshold position plus the color applied there (colors between two stops are interpolated by Excel itself, not written to the file).
ColumnSetting
A single column’s width/visibility/outline setting (<col>, CT_Col) — extended for collapsed.
ConditionalFormattingRule
A conditional formatting rule (<cfRule>, CT_CfRule) applied over a cell range (<conditionalFormatting sqref="..">, CT_ConditionalFormatting).
DataValidationRule
A data validation rule (<dataValidation>, CT_DataValidation) applied over a cell range (sqref).
DefinedName
A named range/formula/constant (<definedName>, CT_DefinedName) — unlike ConditionalFormattingRule/DataValidationRule, this is a workbook-level construct, not attached to any particular Sheet, even when local_sheet_id scopes it to one.
DocumentProperties
Document metadata (docProps/core.xml’s Dublin Core fields plus docProps/app.xml’s Company/Manager/HyperlinkBase, and docProps/custom.xml’s user-defined properties) — extended by. Before both core.xml/app.xml were always written but always empty/boilerplate (see writer.rs’s to_core_properties_xml/ to_app_properties_xml). Only the handful of fields a real document typically carries are modeled — docProps/core.xml’s lastModifiedBy/revision/created/modified/category/contentStatus are still not.
DrawingAnchor
One cell-anchored drawing object (<xdr:twoCellAnchor>, CT_TwoCellAnchor).
ExcelDateTime
A calendar date/time, used to build a CellValue::Date (Cell::date) — deliberately not tied to any external date/time crate (this project’s dependency policy only forbids third-party OOXML-implementing crates, but a plain field struct is simpler still and avoids the question entirely). Only the proleptic Gregorian calendar and Excel’s default “1900 date system” are supported — the legacy “1904 date system” (an old Mac Excel option, <workbookPr date1904="1"/>) is not modeled, same “one well-defined behavior, not every historical Excel quirk” posture as elsewhere in this crate.
ExcelTable
A structured (ListObject) table (<table>, CT_Table) — extended for per-column calculated-column formulas and totals-row functions, and for table_style_name.
ExternalWorkbookLink
A reference to another workbook, used by this workbook’s formulas (<externalReference> in xl/workbook.xml’s <externalReferences>, plus a dedicated xl/externalLinks/externalLinkN.xml part, CT_ExternalReference/CT_ExternalLink). Storage only: this crate neither resolves the referenced workbook nor recomputes any formula against it — a formula cell referencing this link (e.g. "[1]Feuil1!A1" or "'[Budget.xlsx]Feuil1'!A1") is written/read as plain formula text like any other, this type only accounts for the link itself (the part Excel needs to know the reference is legitimate and to cache a fallback value while the other file is closed).
FreezePane
Frozen panes (<pane state="frozen">, CT_Pane). See Sheet.freeze_panes’s doc comment for why only “frozen” (not “split”) panes are modeled.
GradientFill
A cell’s linear gradient fill (<gradientFill degree="..">, CT_GradientFill’s type="linear" form — the default, no type attribute written). The “path” (radial) gradient form is not modeled.
GradientStop
One color stop of a GradientFill (<stop position="..">, CT_GradientStop).
IgnoredError
A suppressed error-checking indicator over one range (<ignoredError>, CT_IgnoredError). Confirmed against sml.xsd (CT_IgnoredErrors/CT_IgnoredError, ECMA-376 SpreadsheetML): sqref is the only required attribute, every error-category flag is an optional boolean defaulting to false. This crate models every flag CT_IgnoredError defines; real Excel’s own “Ignore Error” right-click menu only ever sets one flag at a time per range, but nothing in the schema forbids several flags on the same entry, so this type allows it too (caller’s choice, same “don’t second-guess the caller” posture as ConditionalFormattingRule).
Message
An input or error message attached to a DataValidationRule (promptTitle/prompt or errorTitle/error on CT_DataValidation).
NamedCellStyle
A named cell style (<cellStyle>/its paired <cellStyleXfs> <xf> entry, CT_CellStyle/CT_Xf), declared workbook-wide in xl/styles.xml and referenced from any CellFormat via CellFormat::named_style. This is Excel’s “Cell Styles” gallery: built-in entries like Good/Bad/ Neutral/Heading 1-4/Input/Output/Calculation/Currency/ Percent/Comma, or a caller’s own custom-named style. Confirmed against sml.xsd: CT_CellStyle’s only required attribute is xfId (this crate assigns it automatically, from this entry’s position in Workbook::named_cell_styles, mirroring how a dxfId/table-style dxfId is resolved rather than caller-supplied); name/builtinId are both optional but a real style always sets name at least (an unnamed entry would show as blank in Excel’s gallery, so name is required here, not Option).
PatternFill
A cell’s non-solid pattern fill (<patternFill patternType="..">, CT_PatternFill).
PrintSettings
A sheet’s print/page-setup settings. PrintSettings::default() (everything None) writes no print-related XML at all.
ProtectedRange
One named, independently-passworded protected range (<protectedRange>, CT_ProtectedRange) — point 51, see Sheet::protected_ranges’s doc comment for how this differs from SheetProtection. Confirmed against sml.xsd: name/sqref are the only required attributes; password uses the same legacy 16-bit hash as SheetProtection/WorkbookProtection (see writer.rs::legacy_password_hash’s doc comment) — the newer SHA-512 algorithmName/hashValue/saltValue/spinCount form and the optional securityDescriptor child/attribute (a Windows ACL-based alternative to a password) are not modeled, same “one well-defined mechanism, not every historical Excel option” posture as SheetProtection.
RichTextRun
One run of a CellValue::RichText value: a span of text sharing the same character formatting (<r><rPr>..</rPr><t>..</t></r>, CT_RElt) — a deliberately scoped-down subset of CT_RPrElt’s full run-property surface (bold/italic/color/size only, same subset CellFormat’s own font fields already cover; underline/strike/ vertical-align/font-family are not modeled).
Row
A single row of cells (<row>, CT_Row).
Scenario
A “what-if” scenario (<scenario>, CT_Scenario). Represents one named “what if these cells held these values instead” snapshot, as managed through Excel’s own Data > What-If Analysis > Scenario Manager. This crate only stores the scenario’s definition (name/inputs/comment); it never evaluates the workbook under any scenario (same “storage, not evaluation” posture as formulas).
Sheet
A single worksheet (xl/worksheets/sheetN.xml, CT_Worksheet): a name (shown on Excel’s sheet tab) plus a sequence of rows.
SheetChart
A chart embedded in a sheet’s drawing (<xdr:graphicFrame> referencing a dedicated xl/charts/chartN.xml part via <c:chart r:id="..">), anchored by its enclosing DrawingAnchor. Wraps the whole chart::ChartSpace this crate’s chart dependency already knows how to read/write in full — no Excel-specific chart modeling needed here, and no embedded workbook needed either (an Excel chart reads its series directly from this same workbook’s cells, via each series’ own cell-reference formulas already carried by chart::NumericDataSource/StringDataSource).
SheetDrawing
A sheet’s drawing (xl/drawings/drawingN.xml, CT_Drawing/root <xdr:wsDr>) — an unbounded list of anchored pictures/charts, matching the schema’s own EG_Anchor choice group repeated maxOccurs="unbounded".
SheetPicture
A picture embedded in a sheet’s drawing (<xdr:pic>, CT_Picture — the spreadsheet-drawing flavor, distinct from a:CT_Picture), anchored by its enclosing DrawingAnchor.
SheetProtection
A sheet’s protection settings (<sheetProtection>, CT_SheetProtection). Only the legacy 16-bit password hash (password="XXXX", still fully understood by every version of Excel even though the UI has written the newer SHA-512 hashValue/saltValue/spinCount form since Excel 2013 — see writer.rs::legacy_password_hash’s doc comment) is modeled. Every other CT_SheetProtection flag (formatCells/insertRows/sort/ autoFilter/objects/..) is left at Excel’s own schema default — this crate only ever writes sheet="1" and, if set, password, matching what checking Excel’s own “Protect Sheet” dialog with no extra options touched produces.
SortCondition
One sort key within a SortState (<sortCondition>, CT_SortCondition).
SortState
A remembered sort order (<sortState>, CT_SortState). Written in two different places depending on context: as a child of a worksheet-level <autoFilter> (Sheet::sort_state) or as a sibling of a table’s own <autoFilter> (ExcelTable::sort_state) — see each field’s own doc comment for the exact schema positioning, confirmed via sml.xsd’s CT_AutoFilter/ CT_Table sequences. Only the simplest, most common shape is modeled: a plain value-based ascending/descending sort per range (ST_SortBy’s "value", the schema default) — sortBy="cellColor"/ "fontColor"/"icon", customList, and dxfId/iconSet/iconId (color/ icon-based custom sort criteria) are not modeled, same “the common case, not every historical Excel option” posture as SheetProtection/AutoFilterColumn. Storage only — this crate does not itself reorder any rows, see ExcelTable.sort_state’s doc comment.
TableColumn
One column of an ExcelTable (<tableColumn>, CT_TableColumn) — (plain name only), extended for calculated_formula/ totals_row_function/totals_row_label.
TableStyle
A custom table style definition (<tableStyle>, CT_TableStyle), declared workbook-wide in xl/styles.xml’s <tableStyles> (CT_TableStyles) and referenced by name from an ExcelTable’s own table_style_name. Confirmed against sml.xsd: CT_Stylesheet’s own sequence puts tableStyles right after dxfs, before colors (not written by this crate). This crate only ever writes pivot="0" (this style is for tables, not pivot tables) and no count attribute (CT_TableStyle’s count is informational, Excel recomputes it).
TableStyleElement
One formatted region of a TableStyle (<tableStyleElement>, CT_TableStyleElement).
Workbook
A .xlsx workbook: a sequence of sheets, in the order they appear in Excel’s own sheet tabs.
WorkbookProtection
Workbook structure protection (<workbookProtection>, CT_WorkbookProtection). Locks whether sheets can be added/renamed/hidden/reordered/deleted (lockStructure) and/or whether the workbook’s window can be moved/resized/closed (lockWindows) — distinct from SheetProtection, which locks cell editing within one sheet. Uses the same legacy 16-bit password hash as SheetProtection (see writer.rs::legacy_password_hash’s doc comment for the algorithm and its caveats) — implemented but not yet verified against a real Excel installation.
WriteProtection
Write-protection / “read-only recommended” (<fileSharing>, CT_FileSharing) — point 54, see Workbook::write_protection’s doc comment for how this differs from WorkbookProtection. Confirmed against sml.xsd: readOnlyRecommended defaults to false; userName is a plain display string (shown in Excel’s own “reserved by..” prompt); reservationPassword uses the same legacy 16-bit hash as WorkbookProtection/SheetProtection (see writer.rs::legacy_password_hash’s doc comment) — the newer SHA-512 algorithmName/hashValue/saltValue/spinCount form is not modeled, same “one well-defined mechanism” posture as ProtectedRange.

Enums§

BorderStyle
A border line style (ST_BorderStyle) — only the handful of styles a real spreadsheet actually uses day to day are modeled; hair/mediumDashed/dashDot/mediumDashDot/dashDotDot/ mediumDashDotDot/slantDashDot are not (out of scope, same scope-reduction posture as elsewhere in this crate).
CalculationMode
A workbook’s recalculation mode (<calcPr calcMode="..">, ST_CalcMode).
CellValue
A cell’s value.
CfvoPosition
A threshold position for a ColorScaleStop/DataBar min or max (<cfvo type=".." val="..">, CT_Cfvo) — only the three most common ST_CfvoType values are modeled; formula/percentile/autoMin/ autoMax are not.
ComparisonOperator
A relational comparison operator, shared between ConditionalFormattingCondition::CellIs and DataValidationKind’s WholeNumber/Decimal variants — ECMA-376 defines two separate simple types for these (ST_ConditionalFormattingOperator/ ST_DataValidationOperator), but both share exactly the same 8 relational values, so one Rust enum covers both. Neither schema’s full enumeration is modeled: ST_ConditionalFormattingOperator’s containsText/notContains/beginsWith/endsWith are, despite sharing the same XML attribute, really distinct rule types in Excel’s own “Highlight Cells Rules” UI, not cellIs variants — out of scope.
ConditionalFormattingCondition
A conditional formatting rule’s condition — only cellIs (a direct value comparison) and expression (an arbitrary custom formula) are modeled, CT_CfRule’s two simplest and most common types.
CustomPropertyValue
A single custom document property’s value (docProps/custom.xml, CT_Property’s value xsd:choice — this crate models the same 4 of its many variant types as word-ooxml’s own CustomPropertyValue: vt:lpwstr (Text), vt:bool (Bool), vt:i4 (Int), vt:r8 (Number)). CT_Property also allows a date variant (vt:filetime) and several others (vectors, blobs, currency..) not modeled here — same “simple case first, mirror the sibling crate’s own scope decision” posture as word-ooxml’s own doc comment for this exact type explains.
DataValidationKind
The validation performed by a DataValidationRule.
DrawingObject
The object anchored by a DrawingAnchor — a picture or a chart.
Error
Errors that can occur while reading or writing a .xlsx workbook.
HorizontalAlignment
A cell’s horizontal alignment (ST_HorizontalAlignment) — only the three most common values are modeled; general/fill/justify/ centerContinuous/distributed are not (they read back as None).
HyperlinkTarget
A CellHyperlink’s target.
IconSetType
A ConditionalFormattingCondition::IconSet’s visual style (ST_IconSetType) — only the handful of 3-icon sets most commonly used are modeled.
PageOrientation
A sheet’s page orientation (ST_Orientation) — only portrait/ landscape are modeled, default (a third schema value, treated by Excel as “portrait”) is not, same posture as word-ooxml’s own PageOrientation.
PatternType
A CellFormat::pattern_fill’s pattern (ST_PatternType) — the solid fill is deliberately excluded here (that’s CellFormat::fill_color’s job, the common case); only the non-solid patterns are modeled.
PictureFormat
A picture’s raw image format — mirrors word_ooxml::ImageFormat exactly (same four formats, same extension/content-type mapping), kept as its own type rather than shared across crates since neither host crate depends on the other.
SheetVisibility
A sheet’s tab visibility (<sheet state=".">, ST_SheetState) — replacing the plain bool used since. VeryHidden (unlike Hidden) cannot be un-hidden from Excel’s own “Unhide.” dialog — only from the VBA object model or by editing the file directly — real-world usage is normally to hide implementation-detail sheets (lookup tables, staging data) from end users while still letting formulas reference them.
TableStyleElementType
Which region of a table a TableStyleElement formats (ST_TableStyleType) — only the most commonly used values are modeled (whole-table default, header/total rows, and row/column banding); ST_TableStyleType’s remaining values (firstHeaderCell/ lastHeaderCell/firstTotalCell/lastTotalCell/firstSubtotalColumn/ secondSubtotalColumn/thirdSubtotalColumn/firstSubtotalRow/ secondSubtotalRow/thirdSubtotalRow/blankRow/ firstColumnSubheading/secondColumnSubheading/thirdColumnSubheading/ firstRowSubheading/secondRowSubheading/thirdRowSubheading/ pageFieldLabels/pageFieldValues, confirmed via sml.xsd) cover niche PivotTable-report and outline-subtotal layouts out of this crate’s current scope.
TextComparisonOperator
The comparison performed by a ConditionalFormattingCondition::ContainsText rule — shares the cellIs-adjacent operator attribute name with ComparisonOperator, but is a distinct, disjoint set of values (ST_ConditionalFormattingOperator’s text-comparison subset), so it’s its own enum rather than reusing ComparisonOperator.
TotalsRowFunction
A table column’s totals-row aggregate function (ST_TotalsRowFunction). ST_TotalsRowFunction’s "none" value isn’t modeled as its own variant, same convention as elsewhere in this crate — Option::None on TableColumn::totals_row_function already expresses it.
VerticalAlignment
A cell’s vertical alignment (ST_VerticalAlignment) — only the three most common values are modeled; justify/distributed are not (they read back as None).

Type Aliases§

Result
A Result alias using [Error] as the error type.