ExcelSheetScope
OfficeIMO.Excel
Edits one ExcelSheet: its fluent methods and keywords, each returning this scope.
Inheritance
- object
- ExcelSheetScope
Usage
Explore 23 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 21
- Method ExcelSheetScope.Cell
- Method ExcelSheetScope.Chart
- Method ExcelSheetScope.ColumnWidths
- Method ExcelSheetScope.DefaultColumnWidth
- Method ExcelSheetScope.DefaultRowHeight
- Method ExcelSheetScope.Document
- Method ExcelSheetScope.ExecutionOverride
- Method ExcelSheetScope.Hidden
- Method ExcelSheetScope.Image
- Method ExcelSheetScope.ModernChart
- Method ExcelSheetScope.Name
- Method ExcelSheetScope.OutlineSummary
- Method ExcelSheetScope.PageSetup
- Method ExcelSheetScope.Range
- Method ExcelSheetScope.Sparklines
- Method ExcelSheetScope.TabColor
- Method ExcelSheetScope.Table
- Method ExcelSheetScope.TableStyle
- Method ExcelSheetScope.Table``1
- Method ExcelSheetScope.VeryHidden
- Method ExcelSheetScope.View
Accepted by parameters 2
- Method ExcelDocumentScope.Sheet
- Method ExcelDocumentScope.TableOfContents
Methods
public ExcelSheetScope Cell(string reference, object? value) #Writes a value to the cell at reference.
Parameters
- reference string
- A1 reference of the cell.
- value object?
- Value to write; numbers, dates and booleans keep their type.
public ExcelSheetScope Cell(int row, int column, object? value) #Writes a value to the cell at row and column.
Parameters
- row int
- One-based row.
- column int
- One-based column.
- value object?
- Value to write; numbers, dates and booleans keep their type.
public ExcelSheetScope Cell(int row, int column, Action<ExcelCellScope>? configure = null) #Returns the cell at a 1-based row and column. The handle is a view over the worksheet and stores no cell state, so creating one allocates nothing and does not create the cell until a value or style is written.
Parameters
- row int
- The value.
- column int
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelCellScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Cell(string reference, Action<ExcelCellScope>? configure = null) #Returns the cell at an A1 reference on this worksheet, such as B7 or $B$7.
Parameters
- reference string
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelCellScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Chart(OfficeChartType type, ExcelChartData data, OfficeChartOptions? options = null, Action<ExcelChartScope>? configure = null) #Adds an editable native chart with per-series chart kinds, axes, styles and optional explicit X values.
Parameters
- type OfficeIMO.OfficeChartType
- The value.
- data OfficeIMO.Excel.ExcelChartData
- The value.
- options OfficeIMO.OfficeChartOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelChartScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Chart(OfficeChartType type, ExcelChartDataRange data, OfficeChartOptions? options = null, Action<ExcelChartScope>? configure = null) #Adds an editable chart linked to a worksheet range, including horizontal ranges and ranges on other sheets.
Parameters
- type OfficeIMO.OfficeChartType
- The value.
- data OfficeIMO.Excel.ExcelChartDataRange
- The value.
- options OfficeIMO.OfficeChartOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelChartScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Chart(OfficeChartType type, string rangeOrTable, OfficeChartOptions? options = null, Action<ExcelChartScope>? configure = null) #Adds an editable chart linked to an A1 range or a native table on this worksheet.
Parameters
- type OfficeIMO.OfficeChartType
- The value.
- rangeOrTable string
- The value.
- options OfficeIMO.OfficeChartOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelChartScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Chart(OfficeChartType chartKind, OfficeChartData data, OfficeChartOptions? options = null, Action<ExcelChartScope>? configure = null) #Adds a native Excel chart from the shared OfficeIMO chart contract, including per-series combo kinds and primary or secondary axis assignments.
Parameters
- chartKind OfficeIMO.OfficeChartType
- The value.
- data OfficeIMO.Drawing.OfficeChartData
- The value.
- options OfficeIMO.OfficeChartOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelChartScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope ColumnWidths(IReadOnlyDictionary<int, ExcelColumnWidth> columnWidths) #Applies positive custom widths together and saves the worksheet XML once. Existing column styles, visibility and outline metadata are preserved.
Parameters
- columnWidths System.Collections.Generic.IReadOnlyDictionary<int, OfficeIMO.Excel.ExcelColumnWidth>
- Widths keyed by 1-based column index. Widths above 255 are clamped.
public ExcelSheetScope DefaultColumnWidth(ExcelColumnWidth width, bool save = true) #Sets the worksheet default column width from characters or a physical length.
Parameters
- width OfficeIMO.Excel.ExcelColumnWidth
- Default column width. Excel supports resolved widths up to 255 character units.
- save bool = true
- Whether to save the worksheet XML immediately.
public ExcelSheetScope DefaultRowHeight(ExcelColumnWidth height, bool hidden = false, bool save = true) #Sets the worksheet default row height from characters or a physical length.
Parameters
- height OfficeIMO.Excel.ExcelColumnWidth
- Default row height. Excel supports physical heights up to 409 points.
- hidden bool = false
- Whether empty rows should be hidden by default.
- save bool = true
- Whether to save the worksheet XML immediately.
public ExcelSheetScope Document(Action<ExcelDocument> configure) #Configures ExcelSheet.Document in place: Gets the workbook that owns this worksheet.
Parameters
- configure System.Action<OfficeIMO.Excel.ExcelDocument>
- Configures the value.
public ExcelSheetScope ExecutionOverride(ExcelExecutionPolicy? value) #Sets ExcelSheet.ExecutionOverride: Override execution policy for this sheet. Null = inherit from document.
Parameters
- value OfficeIMO.Excel.ExcelExecutionPolicy?
- The value.
public ExcelSheetScope ExecutionOverride(Action<ExcelExecutionPolicy> configure) #Configures ExcelSheet.ExecutionOverride in place (creating it when not set): Override execution policy for this sheet. Null = inherit from document.
Parameters
- configure System.Action<OfficeIMO.Excel.ExcelExecutionPolicy>
- Configures the value.
public ExcelSheetScope Image(int row, int column, byte[] imageBytes, ExcelImageOptions? options = null, Action<ExcelImageScope>? configure = null) #Embeds native image bytes at a one-based cell and returns the attached image.
Parameters
- row int
- The value.
- column int
- The value.
- imageBytes byte[]
- The value.
- options OfficeIMO.Excel.ExcelImageOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelImageScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Image(int row, int column, string path, ExcelImageOptions? options = null, Action<ExcelImageScope>? configure = null) #Loads an image from a file at a one-based cell and returns the attached image.
Parameters
- row int
- The value.
- column int
- The value.
- path string
- The value.
- options OfficeIMO.Excel.ExcelImageOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelImageScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Image(int row, int column, Stream stream, ExcelImageOptions? options = null, Action<ExcelImageScope>? configure = null) #Loads an image from a stream at a one-based cell and returns the attached image.
Parameters
- row int
- The value.
- column int
- The value.
- stream System.IO.Stream
- The value.
- options OfficeIMO.Excel.ExcelImageOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelImageScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Image(string cellOrRange, byte[] imageBytes, ExcelImageOptions? options = null, Action<ExcelImageScope>? configure = null) #Embeds native image bytes at an A1 cell or two-cell range and returns the attached image.
Parameters
- cellOrRange string
- The value.
- imageBytes byte[]
- The value.
- options OfficeIMO.Excel.ExcelImageOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelImageScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Image(string cellOrRange, string path, ExcelImageOptions? options = null, Action<ExcelImageScope>? configure = null) #Loads an image from a file at an A1 cell or two-cell range and returns the attached image.
Parameters
- cellOrRange string
- The value.
- path string
- The value.
- options OfficeIMO.Excel.ExcelImageOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelImageScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Image(string cellOrRange, Stream stream, ExcelImageOptions? options = null, Action<ExcelImageScope>? configure = null) #Loads an image from a stream at an A1 cell or two-cell range and returns the attached image.
Parameters
- cellOrRange string
- The value.
- stream System.IO.Stream
- The value.
- options OfficeIMO.Excel.ExcelImageOptions? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelImageScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope ModernChart(ExcelChartData data, int row, int column, ExcelModernChartType chartType, string? title = null, OfficeLength? width = null, OfficeLength? height = null, Action<ExcelModernChartScope>? configure = null) #Adds a native ChartEx chart backed by OfficeIMO's shared hidden chart-data owner.
Parameters
- data OfficeIMO.Excel.ExcelChartData
- The value.
- row int
- The value.
- column int
- The value.
- chartType OfficeIMO.Excel.ExcelModernChartType
- The value.
- title string? = null
- The value.
- width OfficeIMO.OfficeLength? = null
- The value.
- height OfficeIMO.OfficeLength? = null
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelModernChartScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Name(string value) #Sets ExcelSheet.Name: Gets or sets the worksheet name.
Parameters
- value string
- The value.
public ExcelSheetScope OutlineSummary(bool? summaryBelow = null, bool? summaryRight = null) #Configures the worksheet outline summary positions shown by Excel.
Parameters
- summaryBelow bool? = null
- Whether row summaries should appear below grouped rows.
- summaryRight bool? = null
- Whether column summaries should appear to the right of grouped columns.
public ExcelSheetScope PageSetup(Action<ExcelSheetPageSetup> configure) #Configures ExcelSheet.PageSetup in place: Paper, orientation, scaling, margins, print area and titles, print options, headers and footers.
Parameters
- configure System.Action<OfficeIMO.Excel.ExcelSheetPageSetup>
- Configures the value.
public ExcelSheetScope Range(string a1Range, Action<ExcelRangeScope>? configure = null) #Returns a range by A1 address, such as A1:V1. A single cell reference returns a one-cell range.
Parameters
- a1Range string
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelRangeScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Range(int firstRow, int firstColumn, int lastRow, int lastColumn, Action<ExcelRangeScope>? configure = null) #Returns the range between two 1-based corner cells.
Parameters
- firstRow int
- The value.
- firstColumn int
- The value.
- lastRow int
- The value.
- lastColumn int
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelRangeScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Sparklines(string dataRange, string locationRange, ExcelSparklineType type, bool displayMarkers = false, bool displayHighLow = false, bool displayFirstLast = false, bool displayNegative = false, bool displayAxis = false, OfficeColor? seriesColor = null, OfficeColor? axisColor = null, OfficeColor? negativeColor = null, OfficeColor? markersColor = null, OfficeColor? highColor = null, OfficeColor? lowColor = null, OfficeColor? firstColor = null, OfficeColor? lastColor = null, Action<ExcelSparklineGroupScope>? configure = null) #Adds sparklines to the worksheet.
Parameters
- dataRange string
- A1 range containing the data (e.g., "B2:M2").
- locationRange string
- A1 range where sparklines will be placed (e.g., "N2:N2").
- type OfficeIMO.Excel.ExcelSparklineType
- Sparkline type.
- displayMarkers bool = false
- Show markers for each data point.
- displayHighLow bool = false
- Show high/low markers.
- displayFirstLast bool = false
- Show first/last markers.
- displayNegative bool = false
- Show negative markers.
- displayAxis bool = false
- Show axis.
- seriesColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- axisColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- negativeColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- markersColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- highColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- lowColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- firstColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- lastColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- configure System.Action<OfficeIMO.Excel.ExcelSparklineGroupScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Sparklines(string dataRange, string locationRange, bool displayMarkers = false, bool displayHighLow = false, bool displayFirstLast = false, bool displayNegative = false, bool displayAxis = false, OfficeColor? seriesColor = null, OfficeColor? axisColor = null, OfficeColor? negativeColor = null, OfficeColor? markersColor = null, OfficeColor? highColor = null, OfficeColor? lowColor = null, OfficeColor? firstColor = null, OfficeColor? lastColor = null, Action<ExcelSparklineGroupScope>? configure = null) #Adds line sparklines to the worksheet.
Parameters
- dataRange string
- A1 range containing the data (e.g., "B2:M2").
- locationRange string
- A1 range where sparklines will be placed (e.g., "N2:N2").
- displayMarkers bool = false
- Show markers for each data point.
- displayHighLow bool = false
- Show high/low markers.
- displayFirstLast bool = false
- Show first/last markers.
- displayNegative bool = false
- Show negative markers.
- displayAxis bool = false
- Show axis.
- seriesColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- axisColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- negativeColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- markersColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- highColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- lowColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- firstColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- lastColor OfficeIMO.OfficeColor? = null
- Optional literal color or theme role.
- configure System.Action<OfficeIMO.Excel.ExcelSparklineGroupScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope TabColor(OfficeColor color) #Sets a literal or theme-based worksheet tab color.
Parameters
- color OfficeIMO.OfficeColor
- A literal RGBA color, native theme role or status color.
public ExcelSheetScope Table(string range, bool hasHeader = true, string? name = null, ExcelTableStyle style = TableStyleMedium2, bool includeAutoFilter = true, ExcelTableNameValidationMode validationMode = Sanitize, Action<ExcelTableScope>? configure = null) #Adds an Excel table to the worksheet over the specified range with optional AutoFilter and name validation behavior.
Parameters
- range string
- Cell range (e.g. "A1:B3") defining the table area.
- hasHeader bool = true
- Indicates whether the first row is a header row.
- name string? = null
- Name of the table. If empty, a default name is used. Examples: "My Table" becomes "My_Table"; "123Report" becomes "_123Report"; spaces and invalid characters are replaced with underscores. If a name already exists in this workbook, a numeric suffix is appended (e.g., "Table", "Table2").
- style OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium2
- Table style to apply.
- includeAutoFilter bool = true
- Whether to include AutoFilter dropdowns in the table headers.
- validationMode OfficeIMO.Excel.ExcelTableNameValidationMode = Sanitize
- Controls how invalid table names are handled: ExcelTableNameValidationMode.Sanitize (default) replaces invalid characters and adjusts the name; ExcelTableNameValidationMode.Strict throws descriptive exceptions for invalid names.
- configure System.Action<OfficeIMO.Excel.ExcelTableScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope Table(DataTable data, OfficeTableOptions? options = null, int row = 1, int column = 1, Action<ExcelTableScope>? configure = null) #Adds an editable native table from a data table, preserving its typed cell values.
Parameters
- data System.Data.DataTable
- The value.
- options OfficeIMO.OfficeTableOptions? = null
- The value.
- row int = 1
- The value.
- column int = 1
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelTableScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope TableStyle(string tableOrRange, ExcelTableStyle style, bool? showFirstColumn = null, bool? showLastColumn = null, bool? showRowStripes = null, bool? showColumnStripes = null) #Updates the visual style flags for the table identified by range, name, or display name.
Parameters
- tableOrRange string
- Table range, name, or display name.
- style OfficeIMO.Excel.ExcelTableStyle
- Table style to apply.
- showFirstColumn bool? = null
- Optional first-column emphasis flag.
- showLastColumn bool? = null
- Optional last-column emphasis flag.
- showRowStripes bool? = null
- Optional row stripe flag.
- showColumnStripes bool? = null
- Optional column stripe flag.
public ExcelSheetScope Table<T>(IEnumerable<T?> rows, OfficeTableOptions? options = null, int row = 1, int column = 1, Action<ExcelTableScope>? configure = null) #Adds an editable native table from typed rows, with columns from the public properties and fields of T.
Type Parameters
- T
- Row type.
Parameters
- rows System.Collections.Generic.IEnumerable<T?>
- Rows to write.
- options OfficeIMO.OfficeTableOptions? = null
- Column selection, ordering, header, formatting, name and style options.
- row int = 1
- One-based row of the table's top-left cell.
- column int = 1
- One-based column of the table's top-left cell.
- configure System.Action<OfficeIMO.Excel.ExcelTableScope>? = null
- Edits the created table.
public ExcelSheetScope Table<T>(IEnumerable<T?> rows, ValueTuple<string, Func<T?, object?>>[] columns, OfficeTableOptions? options = null, int row = 1, int column = 1, Action<ExcelTableScope>? configure = null) #Adds an attached native table using explicit AOT-safe column selectors and the ordinary table options.
Type Parameters
- T
- The type of the value.
Parameters
- rows System.Collections.Generic.IEnumerable<T?>
- The value.
- columns System.ValueTuple<string, System.Func<T?, object?>>[]
- The value.
- options OfficeIMO.OfficeTableOptions? = null
- The value.
- row int = 1
- The value.
- column int = 1
- The value.
- configure System.Action<OfficeIMO.Excel.ExcelTableScope>? = null
- Configures the new item through its scope.
public ExcelSheetScope View(Action<ExcelSheetView> configure) #Configures ExcelSheet.View in place: Frozen panes, gridlines, zero values, headings, direction, zoom and view mode.
Parameters
- configure System.Action<OfficeIMO.Excel.ExcelSheetView>
- Configures the value.
Inherited Methods
Properties
public ExcelSheet Model { get; } #The ExcelSheet this scope edits, for plain C# inside a lambda.