Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelSheet

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
0eef6a5756b9 with working tree changes
Implements
IDisposable

Represents a single worksheet within an ExcelDocument.

Inheritance

  • object
  • ExcelSheet

Usage

Explore 64 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.

Accepted by parameters 44

Methods

public ExcelChart AddBubbleChartFromRanges(IEnumerable<ExcelChartSeriesRange> seriesRanges, int row, int column, OfficeLength? width = null, OfficeLength? height = null, string? title = null) #

Adds a bubble chart using explicit X/Y/size ranges.

Parameters

seriesRanges System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelChartSeriesRange> required
row int required
column int required
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
title string? = null optional

Returns

ExcelChart
AddChart 5 overloads
public ExcelChart AddChart(OfficeChartType type, ExcelChartData data, OfficeChartOptions? options = null) #

Adds an editable native chart with per-series chart kinds, axes, styles and optional explicit X values.

Parameters

type OfficeIMO.OfficeChartType required
data OfficeIMO.Excel.ExcelChartData required
options OfficeIMO.OfficeChartOptions? = null optional

Returns

ExcelChart
public ExcelChart AddChart(OfficeChartType type, ExcelChartDataRange data, OfficeChartOptions? options = null) #

Adds an editable chart linked to a worksheet range, including horizontal ranges and ranges on other sheets.

Parameters

type OfficeIMO.OfficeChartType required
data OfficeIMO.Excel.ExcelChartDataRange required
options OfficeIMO.OfficeChartOptions? = null optional

Returns

ExcelChart
public ExcelChart AddChart(OfficeChartType type, string rangeOrTable, OfficeChartOptions? options = null) #

Adds an editable chart linked to an A1 range or a native table on this worksheet.

Parameters

type OfficeIMO.OfficeChartType required
rangeOrTable string required
options OfficeIMO.OfficeChartOptions? = null optional

Returns

ExcelChart
public ExcelChart AddChart(OfficeChartType chartKind, OfficeChartData data) #

Adds an editable native chart with the format's default title, size and placement.

Parameters

chartKind OfficeIMO.OfficeChartType required
data OfficeIMO.Drawing.OfficeChartData required

Returns

ExcelChart
public ExcelChart AddChart(OfficeChartType chartKind, OfficeChartData data, OfficeChartOptions? options) #

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 required
data OfficeIMO.Drawing.OfficeChartData required
options OfficeIMO.OfficeChartOptions? required

Returns

ExcelChart
public ExcelChart AddChartFromRanges(OfficeChartType type, IEnumerable<ExcelChartSeriesRange> series, OfficeChartOptions? options = null) #

Adds an editable chart of any type whose series reference their own worksheet ranges, which need not be adjacent.

Parameters

type OfficeIMO.OfficeChartType required
series System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelChartSeriesRange> required
options OfficeIMO.OfficeChartOptions? = null optional

Returns

ExcelChart
AddChart``1 2 overloads
public ExcelChart AddChart<T>(OfficeChartType type, IEnumerable<T?> data, string category, params string[] series) #

Adds an editable native chart using property names, including names supplied with nameof.

Type Parameters

T

Parameters

type OfficeIMO.OfficeChartType required
data System.Collections.Generic.IEnumerable<T?> required
category string required
series string[] required

Returns

ExcelChart
public ExcelChart AddChart<T>(OfficeChartType type, IEnumerable<T?> data, string category, OfficeChartOptions? options, params string[] series) #

Adds an editable native chart using property names and shared or format-specific options.

Type Parameters

T

Parameters

type OfficeIMO.OfficeChartType required
data System.Collections.Generic.IEnumerable<T?> required
category string required
options OfficeIMO.OfficeChartOptions? required
series string[] required

Returns

ExcelChart
AddChart``2 2 overloads
public ExcelChart AddChart<T, TCategory>(OfficeChartType type, IEnumerable<T?> data, Func<T?, TCategory?> category, params OfficeSeries[] series) #

Adds an editable native chart from typed category data and numeric series.

Type Parameters

T
TCategory

Parameters

type OfficeIMO.OfficeChartType required
data System.Collections.Generic.IEnumerable<T?> required
category System.Func<T?, TCategory?> required
series OfficeIMO.OfficeSeries[] required

Returns

ExcelChart
public ExcelChart AddChart<T, TCategory>(OfficeChartType type, IEnumerable<T?> data, Func<T?, TCategory?> category, OfficeChartOptions? options, params OfficeSeries[] series) #

Adds an editable native chart from typed data with a title, size and optional format-specific placement.

Type Parameters

T
TCategory

Parameters

type OfficeIMO.OfficeChartType required
data System.Collections.Generic.IEnumerable<T?> required
category System.Func<T?, TCategory?> required
options OfficeIMO.OfficeChartOptions? required
series OfficeIMO.OfficeSeries[] required

Returns

ExcelChart
public ExcelConditionalFormattingInfo AddConditionalFormattingRule(ExcelConditionalFormattingInfo definition) #

Adds a rule from the format-neutral conditional-formatting model.

Parameters

definition OfficeIMO.Excel.ExcelConditionalFormattingInfo required
public ExcelChart AddFunnelChart(IEnumerable<string> categories, IEnumerable<double> values, int row, int column, string title = "Funnel", bool sortDescending = true, OfficeLength? width = null, OfficeLength? height = null) #

Adds a centered funnel-compatible stacked bar chart from category values.

Parameters

categories System.Collections.Generic.IEnumerable<string> required
values System.Collections.Generic.IEnumerable<double> required
row int required
column int required
title string = "Funnel" optional
sortDescending bool = true optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional

Returns

ExcelChart
public ExcelChart AddHistogramChart(IEnumerable<double> values, int row, int column, string title = "Histogram", int? binCount = null, double? binWidth = null, OfficeLength? width = null, OfficeLength? height = null) #

Adds a histogram-compatible column chart after calculating bins from raw numeric observations.

Parameters

values System.Collections.Generic.IEnumerable<double> required
row int required
column int required
title string = "Histogram" optional
binCount int? = null optional
binWidth double? = null optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional

Returns

ExcelChart
public ExcelIgnoredErrorRegionInfo AddIgnoredErrorRegion(IEnumerable<string> ranges, ExcelIgnoredErrorKind errors) #

Adds ignored-error metadata for one or more regions.

Parameters

ranges System.Collections.Generic.IEnumerable<string> required
errors OfficeIMO.Excel.ExcelIgnoredErrorKind required
AddImage 9 overloads
public ExcelImage AddImage(int row, int column, byte[] imageBytes, ExcelImageOptions? options = null) #

Embeds native image bytes at a one-based cell and returns the attached image.

Parameters

row int required
column int required
imageBytes byte[] required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(int row, int column, string path, ExcelImageOptions? options = null) #

Loads an image from a file at a one-based cell and returns the attached image.

Parameters

row int required
column int required
path string required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(int row, int column, Stream stream, ExcelImageOptions? options = null) #

Loads an image from a stream at a one-based cell and returns the attached image.

Parameters

row int required
column int required
stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(string cellOrRange, byte[] imageBytes, ExcelImageOptions? options = null) #

Embeds native image bytes at an A1 cell or two-cell range and returns the attached image.

Parameters

cellOrRange string required
imageBytes byte[] required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(string cellOrRange, string path, ExcelImageOptions? options = null) #

Loads an image from a file at an A1 cell or two-cell range and returns the attached image.

Parameters

cellOrRange string required
path string required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(string cellOrRange, Stream stream, ExcelImageOptions? options = null) #

Loads an image from a stream at an A1 cell or two-cell range and returns the attached image.

Parameters

cellOrRange string required
stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(OfficeLength x, OfficeLength y, byte[] imageBytes, ExcelImageOptions? options = null) #

Embeds native image bytes at a non-negative absolute position and returns the attached image.

Parameters

x OfficeIMO.OfficeLength required
y OfficeIMO.OfficeLength required
imageBytes byte[] required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(OfficeLength x, OfficeLength y, string path, ExcelImageOptions? options = null) #

Loads an image from a file at a non-negative absolute position and returns the attached image.

Parameters

x OfficeIMO.OfficeLength required
y OfficeIMO.OfficeLength required
path string required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
public ExcelImage AddImage(OfficeLength x, OfficeLength y, Stream stream, ExcelImageOptions? options = null) #

Loads an image from a stream at a non-negative absolute position and returns the attached image.

Parameters

x OfficeIMO.OfficeLength required
y OfficeIMO.OfficeLength required
stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageOptions? = null optional

Returns

ExcelImage
AddImageAsync 9 overloads
public async Task<ExcelImage> AddImageAsync(int row, int column, string path, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at a one-based cell and returns the attached image. Only source I/O is asynchronous.

Parameters

row int required
column int required
path string required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(int row, int column, Stream stream, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at a one-based cell and returns the attached image. Only source I/O is asynchronous.

Parameters

row int required
column int required
stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(int row, int column, Uri uri, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at a one-based cell and returns the attached image. Only source I/O is asynchronous.

Parameters

row int required
column int required
uri System.Uri required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(string cellOrRange, string path, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at an A1 cell or two-cell range and returns the attached image. Only source I/O is asynchronous.

Parameters

cellOrRange string required
path string required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(string cellOrRange, Stream stream, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at an A1 cell or two-cell range and returns the attached image. Only source I/O is asynchronous.

Parameters

cellOrRange string required
stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(string cellOrRange, Uri uri, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at an A1 cell or two-cell range and returns the attached image. Only source I/O is asynchronous.

Parameters

cellOrRange string required
uri System.Uri required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(OfficeLength x, OfficeLength y, string path, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at a non-negative absolute position and returns the attached image. Only source I/O is asynchronous.

Parameters

x OfficeIMO.OfficeLength required
y OfficeIMO.OfficeLength required
path string required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(OfficeLength x, OfficeLength y, Stream stream, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at a non-negative absolute position and returns the attached image. Only source I/O is asynchronous.

Parameters

x OfficeIMO.OfficeLength required
y OfficeIMO.OfficeLength required
stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public async Task<ExcelImage> AddImageAsync(OfficeLength x, OfficeLength y, Uri uri, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an image at a non-negative absolute position and returns the attached image. Only source I/O is asynchronous.

Parameters

x OfficeIMO.OfficeLength required
y OfficeIMO.OfficeLength required
uri System.Uri required
options OfficeIMO.Excel.ExcelImageOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ExcelImage>
public ExcelPageBreak AddManualColumnPageBreak(int column, bool save = true) #

Adds a manual worksheet column page break after the specified one-based column.

Parameters

column int required
save bool = true optional
public ExcelPageBreak AddManualRowPageBreak(int row, bool save = true) #

Adds a manual worksheet row page break after the specified one-based row.

Parameters

row int required
save bool = true optional
public ExcelModernChart AddModernChart(ExcelChartData data, int row, int column, ExcelModernChartType chartType, string? title = null, OfficeLength? width = null, OfficeLength? height = null) #

Adds a native ChartEx chart backed by OfficeIMO's shared hidden chart-data owner.

Parameters

data OfficeIMO.Excel.ExcelChartData required
row int required
column int required
chartType OfficeIMO.Excel.ExcelModernChartType required
title string? = null optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
public ExcelChart AddParetoChart(IEnumerable<string> categories, IEnumerable<double> values, int row, int column, string title = "Pareto", OfficeLength? width = null, OfficeLength? height = null) #

Adds a Pareto-compatible column and cumulative-percentage line chart.

Parameters

categories System.Collections.Generic.IEnumerable<string> required
values System.Collections.Generic.IEnumerable<double> required
row int required
column int required
title string = "Pareto" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional

Returns

ExcelChart
public ExcelChart AddPivotChartFromRange(string pivotTableName, string dataRangeA1, int row, int column, OfficeLength? width = null, OfficeLength? height = null, OfficeChartType type = Column, bool hasHeaders = true, string? title = null, bool includeCachedData = true, uint formatId = 0) #

Adds a chart using an A1 range and marks it as sourced from an existing pivot table.

Parameters

pivotTableName string required
dataRangeA1 string required
row int required
column int required
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
type OfficeIMO.OfficeChartType = Column optional
hasHeaders bool = true optional
title string? = null optional
includeCachedData bool = true optional
formatId uint = 0 optional

Returns

ExcelChart
public ExcelPivotGroupingInfo AddPivotManualGrouping(string pivotTableName, string sourceFieldName, string groupFieldName, IReadOnlyDictionary<string, string[]> groups, IReadOnlyCollection<string>? hiddenGroupItems = null) #

Adds a derived manual text grouping field and hides selected group labels.

Parameters

pivotTableName string required
sourceFieldName string required
groupFieldName string required
groups System.Collections.Generic.IReadOnlyDictionary<string, string[]> required
hiddenGroupItems System.Collections.Generic.IReadOnlyCollection<string>? = null optional
AddPivotTable 3 overloads
public ExcelPivotTable AddPivotTable(string sourceRange, string destinationCell) #

Creates a pivot table from a worksheet range and returns its editable object.

Parameters

sourceRange string required
destinationCell string required
public ExcelPivotTable AddPivotTable(string sourceRange, string destinationCell, ExcelPivotTableOptions? options) #

Creates a pivot table from a worksheet range using the supplied authoring options.

Parameters

sourceRange string required
destinationCell string required
options OfficeIMO.Excel.ExcelPivotTableOptions? required
public ExcelPivotTable AddPivotTable(ExcelSheet sourceSheet, string sourceRange, string destinationCell, ExcelPivotTableOptions? options = null) #

Creates an editable pivot on this worksheet using source cells from another worksheet in the same workbook.

Parameters

sourceSheet OfficeIMO.Excel.ExcelSheet required
sourceRange string required
destinationCell string required
options OfficeIMO.Excel.ExcelPivotTableOptions? = null optional
public ExcelChart AddScatterChartFromRanges(IEnumerable<ExcelChartSeriesRange> seriesRanges, int row, int column, OfficeLength? width = null, OfficeLength? height = null, string? title = null) #

Adds a scatter chart using explicit X/Y ranges.

Parameters

seriesRanges System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelChartSeriesRange> required
row int required
column int required
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
title string? = null optional

Returns

ExcelChart
AddSparklines 2 overloads
public ExcelSparklineGroup AddSparklines(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) #

Adds sparklines to the worksheet.

Parameters

dataRange string required
A1 range containing the data (e.g., "B2:M2").
locationRange string required
A1 range where sparklines will be placed (e.g., "N2:N2").
type OfficeIMO.Excel.ExcelSparklineType required
Sparkline type.
displayMarkers bool = false optional
Show markers for each data point.
displayHighLow bool = false optional
Show high/low markers.
displayFirstLast bool = false optional
Show first/last markers.
displayNegative bool = false optional
Show negative markers.
displayAxis bool = false optional
Show axis.
seriesColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
axisColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
negativeColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
markersColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
highColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
lowColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
firstColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
lastColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
public ExcelSparklineGroup AddSparklines(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) #

Adds line sparklines to the worksheet.

Parameters

dataRange string required
A1 range containing the data (e.g., "B2:M2").
locationRange string required
A1 range where sparklines will be placed (e.g., "N2:N2").
displayMarkers bool = false optional
Show markers for each data point.
displayHighLow bool = false optional
Show high/low markers.
displayFirstLast bool = false optional
Show first/last markers.
displayNegative bool = false optional
Show negative markers.
displayAxis bool = false optional
Show axis.
seriesColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
axisColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
negativeColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
markersColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
highColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
lowColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
firstColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
lastColor OfficeIMO.OfficeColor? = null optional
Optional literal color or theme role.
AddTable 2 overloads
public ExcelTable AddTable(string range, bool hasHeader = true, string? name = null, ExcelTableStyle style = TableStyleMedium2, bool includeAutoFilter = true, ExcelTableNameValidationMode validationMode = Sanitize) #

Adds an Excel table to the worksheet over the specified range with optional AutoFilter and name validation behavior.

Parameters

range string required
Cell range (e.g. "A1:B3") defining the table area.
hasHeader bool = true optional
Indicates whether the first row is a header row.
name string? = null optional
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 optional
Table style to apply.
includeAutoFilter bool = true optional
Whether to include AutoFilter dropdowns in the table headers.
validationMode OfficeIMO.Excel.ExcelTableNameValidationMode = Sanitize optional
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.

Returns

ExcelTable
public ExcelTable AddTable(DataTable data, OfficeTableOptions? options = null, int row = 1, int column = 1) #

Adds an editable native table from a data table, preserving its typed cell values.

Parameters

data System.Data.DataTable required
options OfficeIMO.OfficeTableOptions? = null optional
row int = 1 optional
column int = 1 optional

Returns

ExcelTable
AddTable``1 2 overloads
public ExcelTable AddTable<T>(IEnumerable<T?> rows, ValueTuple<string, Func<T?, object?>>[] columns, OfficeTableOptions? options = null, int row = 1, int column = 1) #

Adds an attached native table using explicit AOT-safe column selectors and the ordinary table options.

Type Parameters

T

Parameters

rows System.Collections.Generic.IEnumerable<T?> required
columns System.ValueTuple<string, System.Func<T?, object?>>[] required
options OfficeIMO.OfficeTableOptions? = null optional
row int = 1 optional
column int = 1 optional

Returns

ExcelTable
public ExcelTable AddTable<T>(IEnumerable<T?> rows, OfficeTableOptions? options = null, int row = 1, int column = 1) #

Adds an editable native table from typed properties, fields, or string-keyed dictionary columns.

Type Parameters

T

Parameters

rows System.Collections.Generic.IEnumerable<T?> required
options OfficeIMO.OfficeTableOptions? = null optional
row int = 1 optional
column int = 1 optional

Returns

ExcelTable
AddThreadedComment 2 overloads
public ExcelThreadedCommentResult AddThreadedComment(ExcelThreadedCommentOptions options) #

Adds a threaded comment or threaded reply to the worksheet while maintaining workbook person metadata.

Parameters

options OfficeIMO.Excel.ExcelThreadedCommentOptions required
Threaded comment options.
public ExcelThreadedCommentResult AddThreadedComment(string address, string text, string author = "OfficeIMO", string? parentId = null, bool done = false) #

Adds a threaded comment or threaded reply to the worksheet.

Parameters

address string required
text string required
author string = "OfficeIMO" optional
parentId string? = null optional
done bool = false optional
public IReadOnlyList<ExcelThreadedCommentResult> AddThreadedComments(IEnumerable<ExcelThreadedCommentOptions> options) #

Adds comments and replies as one prevalidated batch, indexing workbook identities and saving each part once. Replies must refer to an existing root or an earlier root in the batch, on this worksheet and cell.

Parameters

options System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelThreadedCommentOptions> required
Comment options, captured before package mutation.

Returns

IReadOnlyList<ExcelThreadedCommentResult> Results in input order.
public ExcelChart AddWaterfallChart(IEnumerable<string> categories, IEnumerable<double> changes, int row, int column, string title = "Waterfall", bool includeTotal = true, string totalLabel = "Total", OfficeLength? width = null, OfficeLength? height = null) #

Adds a waterfall-compatible stacked column chart from signed changes and an optional final total.

Parameters

categories System.Collections.Generic.IEnumerable<string> required
changes System.Collections.Generic.IEnumerable<double> required
row int required
column int required
title string = "Waterfall" optional
includeTotal bool = true optional
totalLabel string = "Total" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional

Returns

ExcelChart
public string AppendDataTableToTable(DataTable dataTable, string tableName, bool matchColumnsByHeader = true, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Appends rows from a DataTable to an existing Excel table and expands the table range.

Parameters

dataTable System.Data.DataTable required
Source DataTable containing rows to append.
tableName string required
Existing table name or display name.
matchColumnsByHeader bool = true optional
When true, DataTable columns are matched to table columns by header text. When false, columns are appended by position.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Optional execution mode override.
ct System.Threading.CancellationToken = default optional
Cancellation token.

Returns

string The updated A1 range of the table.

Exceptions

  • ArgumentNullException – Thrown when dataTable or tableName is null.
  • ArgumentException – Thrown when the source columns cannot be mapped to the existing table.
  • InvalidOperationException – Thrown when the table cannot be found or cannot be safely expanded.
public IReadOnlyList<ExcelColumnFormatResult> ApplyColumnFormatPlan(ExcelColumnFormatPlan plan, bool includeHeader = false, bool autoFit = false, int? headerRow = null, ExcelReaderOptions? options = null) #

Applies reusable header-based column number formats to the worksheet.

Parameters

plan OfficeIMO.Excel.ExcelColumnFormatPlan required
Column format plan to apply.
includeHeader bool = false optional
True to include header cells in every rule unless a rule already includes them.
autoFit bool = false optional
True to auto-fit every resolved formatted column.
headerRow int? = null optional
Optional one-based row containing the headers used to resolve column names.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Read options used while resolving headers.

Returns

IReadOnlyList<ExcelColumnFormatResult> One result per configured rule.
public void ApplyNamedStyle(string name, string range, int maximumCells = 1000000, CancellationToken cancellationToken = default) #

Applies a workbook named style to a range with cancellation and a hard cell budget.

Parameters

name string required
range string required
maximumCells int = 1000000 optional
cancellationToken System.Threading.CancellationToken = default optional
ApplyTemplate 4 overloads
public int ApplyTemplate(IDictionary<string, object?> values, IFormatProvider? provider = null, bool throwOnMissing = false) #

Replaces {{Marker}} placeholders in text cells on this worksheet using the supplied values.

Parameters

values System.Collections.Generic.IDictionary<string, object?> required
provider System.IFormatProvider? = null optional
throwOnMissing bool = false optional

Returns

int
public int ApplyTemplate(IDictionary<string, object?> values, ExcelTemplateOptions options) #

Replaces {{Marker}} placeholders in text cells on this worksheet using the supplied values and options.

Parameters

values System.Collections.Generic.IDictionary<string, object?> required
options OfficeIMO.Excel.ExcelTemplateOptions required

Returns

int
public int ApplyTemplate(object model, IFormatProvider? provider = null, bool throwOnMissing = false) #

Replaces {{Marker}} placeholders in text cells on this worksheet using public properties from the supplied model. Nested properties are exposed as dotted marker names, for example {{Customer.Name}}.

Parameters

model object required
provider System.IFormatProvider? = null optional
throwOnMissing bool = false optional

Returns

int
public int ApplyTemplate(object model, ExcelTemplateOptions options) #

Replaces {{Marker}} placeholders in text cells on this worksheet using public properties from the supplied model and options. Nested properties are exposed as dotted marker names, for example {{Customer.Name}}.

Parameters

model object required
options OfficeIMO.Excel.ExcelTemplateOptions required

Returns

int
ApplyTemplateOptionalRows 2 overloads
public int ApplyTemplateOptionalRows(int firstRow, int rowCount, bool include, IDictionary<string, object?> values, ExcelTemplateOptions? options = null) #

Includes or removes an optional worksheet row block. When included, markers in the block are bound with the supplied values. When removed, following worksheet rows are shifted up.

Parameters

firstRow int required
1-based first row in the optional block.
rowCount int required
Number of rows in the optional block.
include bool required
True to keep and bind the block; false to remove it.
values System.Collections.Generic.IDictionary<string, object?> required
Values used when the block is included.
options OfficeIMO.Excel.ExcelTemplateOptions? = null optional
Optional template binding options.

Returns

int
public int ApplyTemplateOptionalRows(int firstRow, int rowCount, bool include, object model, ExcelTemplateOptions? options = null) #

Includes or removes an optional worksheet row block. When included, markers in the block are bound from public properties on the supplied model. When removed, following worksheet rows are shifted up.

Parameters

firstRow int required
1-based first row in the optional block.
rowCount int required
Number of rows in the optional block.
include bool required
True to keep and bind the block; false to remove it.
model object required
Model used when the block is included.
options OfficeIMO.Excel.ExcelTemplateOptions? = null optional
Optional template binding options.

Returns

int
public int ApplyTemplateRows(int templateRow, IEnumerable<IDictionary<string, object?>> rows, ExcelTemplateOptions? options = null) #

Repeats a single template row for each supplied row value dictionary, inserting additional worksheet rows as needed.

Parameters

templateRow int required
1-based row number containing template markers.
rows System.Collections.Generic.IEnumerable<System.Collections.Generic.IDictionary<string, object?>> required
Row value dictionaries. Each dictionary is bound to one copied row.
options OfficeIMO.Excel.ExcelTemplateOptions? = null optional
Optional template binding options.

Returns

int
public int ApplyTemplateRows<T>(int templateRow, IEnumerable<T> rows, ExcelTemplateOptions? options = null) #

Repeats a single template row for each supplied row model, inserting additional worksheet rows as needed. Public properties are exposed as marker names, including nested dotted names.

Type Parameters

T

Parameters

templateRow int required
1-based row number containing template markers.
rows System.Collections.Generic.IEnumerable<T> required
Row models. Each model is bound to one copied row.
options OfficeIMO.Excel.ExcelTemplateOptions? = null optional
Optional template binding options.

Returns

int
public void AutoFitColumn(int columnIndex) #

Auto-fits the width of the specified column based on its contents.

Parameters

columnIndex int required
1-based column index.
public void AutoFitColumns(ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Automatically fits all columns based on their content.

Parameters

mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Overrides how the auto-fit work is scheduled across columns.
ct System.Threading.CancellationToken = default optional
Cancels the auto-fit pass while widths are being measured or applied.
public void AutoFitColumnsExcept(IEnumerable<int> columnsToSkip, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Automatically fits all columns except the supplied indexes.

Parameters

columnsToSkip System.Collections.Generic.IEnumerable<int> required
1-based column indexes that should not be resized.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Overrides how the auto-fit work is scheduled for the remaining columns.
ct System.Threading.CancellationToken = default optional
Cancels the auto-fit pass before it completes.
public void AutoFitColumnsFor(IEnumerable<int> columnIndexes, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Automatically fits the supplied set of column indexes.

Parameters

columnIndexes System.Collections.Generic.IEnumerable<int> required
1-based column indexes that should be resized to fit their content.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Overrides how the auto-fit work is scheduled across the selected columns.
ct System.Threading.CancellationToken = default optional
Cancels the auto-fit pass for the selected columns.
public void AutoFitRow(int rowIndex) #

Auto-fits the height of the specified row based on its contents.

Parameters

rowIndex int required
1-based row index.
public void AutoFitRows(ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Automatically fits all rows based on their content.

Parameters

mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Overrides how the auto-fit work is scheduled across rows.
ct System.Threading.CancellationToken = default optional
Cancels the row auto-fit pass while heights are being calculated or applied.
public void Batch(Action<ExcelSheet> action) #

Executes multiple worksheet mutations under a single workbook write lock. Cell styling inside the batch (bold, fills, fonts, wrapping, number formats and similar) looks formats up through an index and saves the stylesheet once when the batch ends, so styling cells row by row stays proportional to the cells styled.

Parameters

action System.Action<OfficeIMO.Excel.ExcelSheet> required
The worksheet updates to execute.
Cell 2 overloads
public ExcelCell Cell(int row, int column) #

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 required
column int required

Returns

ExcelCell

Exceptions

  • ArgumentOutOfRangeException – The row or column is outside the worksheet.
public ExcelCell Cell(string reference) #

Returns the cell at an A1 reference on this worksheet, such as B7 or $B$7.

Parameters

reference string required

Returns

ExcelCell

Exceptions

  • ArgumentException – The reference is not one cell on this worksheet.
public ExcelChartGridLayout ChartLayout(int row, int column, OfficeLength? width = null, OfficeLength? height = null, int chartsPerRow = 2, OfficeLength? horizontalGap = null, int verticalGapRows = 2) #

Creates a sequential chart layout helper for dashboard-style worksheets that use the default Excel row and column grid.

Parameters

row int required
One-based worksheet row for the first chart.
column int required
One-based worksheet column for the first chart.
width OfficeIMO.OfficeLength? = null optional
Default chart physical width.
height OfficeIMO.OfficeLength? = null optional
Default chart physical height.
chartsPerRow int = 2 optional
Number of charts to place before wrapping to the next row.
horizontalGap OfficeIMO.OfficeLength? = null optional
Minimum horizontal physical gap between chart slots, calculated against default-width Excel columns.
verticalGapRows int = 2 optional
Minimum vertical gap between chart rows, in worksheet rows, calculated against default-height Excel rows.

Returns

ExcelChartGridLayout A layout helper that produces chart placement slots.
public void ClearArrayFormula(string a1RangeOrCell) #

Clears an array formula whose reference overlaps the supplied range or cell.

Parameters

a1RangeOrCell string required
public void ClearCachedFormulaResults() #

Removes cached values from formula cells on this sheet.

public void ClearColumnGroup(int startColumn, int endColumn, bool unhide = true) #

Clears Excel outline grouping metadata from a contiguous range of worksheet columns.

Parameters

startColumn int required
First 1-based column to clear.
endColumn int required
Last 1-based column to clear.
unhide bool = true optional
Whether hidden columns in the cleared range should be shown.
ClearComment 2 overloads
public void ClearComment(int row, int column) #

Removes a comment from the specified cell (if present).

Parameters

row int required
1-based row index.
column int required
1-based column index.
public void ClearComment(string a1) #

Removes a comment from the specified A1 cell reference (if present).

Parameters

a1 string required
A1 cell reference (e.g., "B5").
public int ClearComments(ExcelCommentFilter filter) #

Removes comments that match the supplied filter.

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter required
Author, text, and/or A1 range filter used to choose comments.

Returns

int Number of comments removed.
public void ClearConditionalFormatting(string? a1Range = null) #

Clears conditional formatting rules, optionally restricted to a range.

Parameters

a1Range string? = null optional
public void ClearHeaderCache() #

Clears the cached header map.

public void ClearIgnoredErrorRegions() #

Clears all standard ignored-error regions.

public bool ClearManualColumnPageBreaks(bool save = true) #

Clears all manual worksheet column page breaks.

Parameters

save bool = true optional

Returns

bool
public bool ClearManualPageBreaks(bool save = true) #

Clears all manual worksheet row and column page breaks.

Parameters

save bool = true optional

Returns

bool
public bool ClearManualRowPageBreaks(bool save = true) #

Clears all manual worksheet row page breaks.

Parameters

save bool = true optional

Returns

bool
public void ClearRowGroup(int startRow, int endRow, bool unhide = true) #

Clears Excel outline grouping metadata from a contiguous range of worksheet rows.

Parameters

startRow int required
First 1-based row to clear.
endRow int required
Last 1-based row to clear.
unhide bool = true optional
Whether hidden rows in the cleared range should be shown.
public int ClearSparklines() #

Removes all worksheet sparkline groups.

Returns

int
public void ClearTabColor() #

Clears the worksheet tab color.

public void ClearTableTotals(string tableOrRange) #

Clears totals-row settings for the table identified by range, name, or display name.

Parameters

tableOrRange string required
Table range, name, or display name.
public ExcelConditionalFormattingInfo CloneConditionalFormattingRule(ExcelConditionalFormattingInfo rule, string targetRange, int? priority = null) #

Clones a rule, including unrecognized attributes and child markup, to another range.

Parameters

rule OfficeIMO.Excel.ExcelConditionalFormattingInfo required
targetRange string required
priority int? = null optional
public ExcelColumnStyleByHeaderBuilder ColumnStyleByHeader(string header, bool includeHeader = false, ExcelReaderOptions? options = null) #

Returns a builder for styling a column resolved by header with discoverable methods. When the header cannot be resolved an inert builder is returned so calls become no-ops.

Parameters

header string required
Header text used to resolve the target column after applying any configured normalization.
includeHeader bool = false optional
True to include the header row when styling; false to begin styling from the first data row.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Read options that control header normalization and other resolution behavior.
public ExcelWorkbookDataReader CreateDataReader(ExcelReaderOptions? options = null) #

Creates a forward-only data reader over this worksheet in the current open workbook, including unsaved edits.

Parameters

options OfficeIMO.Excel.ExcelReaderOptions? = null optional
public ExcelRangeVisualInfo CreateVisualSnapshot(ExcelImageExportOptions? options = null) #

Creates a format-neutral visual snapshot for a worksheet range or the used range.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
public ExcelNamedStyleInfo DefineNamedStyle(string name, int sourceRow, int sourceColumn, bool hidden = false) #

Creates or replaces a workbook named style from a cell's current formatting.

Parameters

name string required
sourceRow int required
sourceColumn int required
hidden bool = false optional
public ExcelMutationResult DeleteCells(string range, ExcelCellShiftDirection direction, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default) #

Transactionally deletes cells.

Parameters

range string required
direction OfficeIMO.Excel.ExcelCellShiftDirection required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void DeleteColumns(int firstColumn, int count = 1) #

Deletes worksheet columns starting at firstColumn and shifts following columns left. Formula references to cells fully removed by the operation become #REF!; partially overlapping ranges are reduced to the surviving cells. Use ExcelSheet.DeleteColumnsTransactional for rollback and post-edit diagnostics.

Parameters

firstColumn int required
count int = 1 optional

Exceptions

  • ArgumentOutOfRangeException – The requested columns fall outside the worksheet column limit.
  • InvalidOperationException – The deletion would remove every column of a table, or intersect an array formula, data table or PivotTable output range, or the worksheet contains unsupported controls.
public ExcelMutationResult DeleteColumnsTransactional(int firstColumn, int count = 1, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default) #

Plans and transactionally deletes columns with bounded rollback and post-edit diagnostics.

Parameters

firstColumn int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void DeleteRows(int firstRow, int count = 1) #

Deletes worksheet rows starting at firstRow and shifts following rows up. Formula references to cells fully removed by the operation become #REF!; partially overlapping ranges are reduced to the surviving cells.

Parameters

firstRow int required
The 1-based first row to delete.
count int = 1 optional
The number of rows to delete.

Exceptions

  • ArgumentOutOfRangeException – Thrown when the requested rows fall outside the worksheet row limit.
  • InvalidOperationException – Thrown when the deletion would remove an owned table boundary or intersect an array-formula, data-table, or PivotTable output range that cannot be rebuilt safely, when the workbook uses R1C1 reference mode, or when the worksheet contains unsupported form controls, OLE objects, or single-cell XML mappings.
public ExcelMutationResult DeleteRowsTransactional(int firstRow, int count = 1, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default) #

Plans and transactionally deletes rows with bounded rollback and post-edit diagnostics.

Parameters

firstRow int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void Dispose() #

Releases resources held by this worksheet.

public IEnumerable<ExcelCellValueInfo> EnumerateCells(ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the non-empty cells in this worksheet without probing every coordinate in its used range. Enumerate the returned sequence while the owning ExcelDocument is still open.

Parameters

options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<ExcelCellValueInfo>
public IEnumerable<ExcelCellValueInfo> EnumerateRange(string a1Range, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the non-empty cells in the specified A1 range without probing every coordinate in the range. Enumerate the returned sequence while the owning ExcelDocument is still open.

Parameters

a1Range string required
Inclusive A1 range (for example, "A1:C100").
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<ExcelCellValueInfo>
public IReadOnlyList<ExcelCommentInfo> FindComments(ExcelCommentFilter? filter) #

Finds legacy worksheet comments (notes) that match the supplied filter.

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter? required
Optional author, text, and A1 range filter.

Returns

IReadOnlyList<ExcelCommentInfo>
public string? FindFirst(string text) #

Finds the first cell text that contains the specified value. Returns the A1 address or null. Searches values rendered as text (shared strings, inline strings, numbers as invariant strings).

Parameters

text string required

Returns

string?
public void ForEachColumn(string a1, Action<int> action) #

Iterates over column indices inside an A1 range and invokes action for each column.

Parameters

a1 string required
A1 range without a sheet prefix.
action System.Action<int> required
Callback receiving a 1-based column index.

Examples

sheet.ForEachRow("A2:A10", r => sheet.SetInternalLink(r, 1, "'Summary'!A1", "Back"));

public void ForEachRow(string a1, Action<int> action) #

Iterates over row indices inside an A1 range and invokes action for each row.

Parameters

a1 string required
A1 range without a sheet prefix.
action System.Action<int> required
Callback receiving a 1-based row index.

Examples

var bounds = sheet.GetRangeBounds("A2:D20"); // bounds.r1=2, bounds.c1=1, bounds.r2=20, bounds.c2=4

FromXml 2 overloads
public string FromXml(string xml, int startRow = 1, int startColumn = 1, bool includeHeaders = false, ExcelXmlTableOptions? options = null, ExcelExecutionMode? mode = null) #

Inserts a positional or explicitly mapped XML table and returns the inserted A1 range. Text remains literal, including formula-looking strings. The XML is fully admitted and converted before worksheet mutation.

Parameters

xml string required
XML table text, separate from an XML Spreadsheet workbook.
startRow int = 1 optional
First destination row, one-based.
startColumn int = 1 optional
First destination column, one-based.
includeHeaders bool = false optional
Writes mapped column names, or positional Column1, Column2 names.
options OfficeIMO.Excel.ExcelXmlTableOptions? = null optional
Explicit schema and resource limits.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Existing worksheet insertion execution mode.

Returns

string
public string FromXml(Stream input, int startRow = 1, int startColumn = 1, bool includeHeaders = false, ExcelXmlTableOptions? options = null, ExcelExecutionMode? mode = null) #

Inserts a bounded XML table from a caller-owned stream; the stream remains open.

Parameters

input System.IO.Stream required
Readable XML table stream.
startRow int = 1 optional
First destination row, one-based.
startColumn int = 1 optional
First destination column, one-based.
includeHeaders bool = false optional
Writes mapped or positional column headers.
options OfficeIMO.Excel.ExcelXmlTableOptions? = null optional
Explicit schema and resource limits.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Existing worksheet insertion execution mode.

Returns

string
public IReadOnlyDictionary<string, string> GetAllNamedRanges() #

Returns all defined names visible to this sheet with their A1 ranges.

Returns

IReadOnlyDictionary<string, string>
public IReadOnlyList<ExcelAllowedEditRangeInfo> GetAllowedEditRanges() #

Lists allowed-edit regions without exposing Open XML types.

Returns

IReadOnlyList<ExcelAllowedEditRangeInfo>
public IReadOnlyList<ExcelAutoFilterInfo> GetAutoFilters() #

Reads worksheet and table AutoFilter criteria/state.

Returns

IReadOnlyList<ExcelAutoFilterInfo>
public IReadOnlyList<ExcelNativeCellValueInfo?> GetCellValueSnapshots(int column, int firstRow, int lastRow) #

Reads the native value metadata of one column for a range of rows in a single pass.

Parameters

column int required
The 1-based column index to read.
firstRow int required
The 1-based first row to read.
lastRow int required
The 1-based last row to read.

Returns

IReadOnlyList<ExcelNativeCellValueInfo?> One snapshot or null per row from firstRow to lastRow.
public ExcelChart? GetChart(string name) #

Returns a chart by name (non-visual name), or null if not found.

Parameters

name string required

Returns

ExcelChart?
GetColumnDefinitions 2 overloads
public IReadOnlyList<ExcelColumnInfo> GetColumnDefinitions() #

Gets explicit worksheet column definitions such as custom widths and hidden ranges.

Returns

IReadOnlyList<ExcelColumnInfo>
public IReadOnlyList<ExcelColumnInfo> GetColumnDefinitions(CancellationToken cancellationToken) #

Gets explicit worksheet column definitions, observing cancellation while deferred data is materialized.

Parameters

cancellationToken System.Threading.CancellationToken required
Cancels deferred materialization and column inspection.

Returns

IReadOnlyList<ExcelColumnInfo>

Exceptions

  • OperationCanceledException – The operation was canceled.
public string GetColumnRangeByHeader(string headerName, string? tableName = null, int headerRow = 0, bool includeHeader = false, bool normalizeHeader = true) #

Resolves the data range for a worksheet or table column by matching its header text.

Parameters

headerName string required
Header or table column name to match.
tableName string? = null optional
Optional table name, display name, or range. When omitted, the worksheet header row is scanned.
headerRow int = 0 optional
Worksheet header row to scan when tableName is omitted. Use 0 to scan the first row of the used range.
includeHeader bool = false optional
Include the matched header cell in the returned range.
normalizeHeader bool = true optional
Normalize repeated whitespace before comparing headers.

Returns

string A single-column A1 range for the matched column.
public IReadOnlyList<ExcelCommentInfo> GetComments() #

Gets all legacy worksheet comments (notes) on this sheet.

Returns

IReadOnlyList<ExcelCommentInfo>
public IReadOnlyList<ExcelConditionalFormattingInfo> GetConditionalFormattingRules(string? a1Range = null) #

Lists conditional formatting rules on the worksheet.

Parameters

a1Range string? = null optional

Returns

IReadOnlyList<ExcelConditionalFormattingInfo>
public IReadOnlyList<ExcelDataValidationInfo> GetDataValidations(string? a1Range = null) #

Lists data validation rules on the worksheet.

Parameters

a1Range string? = null optional

Returns

IReadOnlyList<ExcelDataValidationInfo>
public IReadOnlyList<ExcelFormulaCellInfo> GetFormulaCells() #

Returns formula cells on this sheet without changing workbook contents.

Returns

IReadOnlyList<ExcelFormulaCellInfo>
public string? GetFormulaText(int row, int column) #

Returns the formula text from a cell, if present.

Parameters

row int required
column int required

Returns

string?
public Dictionary<string, int> GetHeaderMap(ExcelReaderOptions? options = null) #

Builds or returns a cached case-insensitive map of header name to 1-based column index using the first row of UsedRange. Cache reuse respects the used range, header conversion options and named-style replacements.

Parameters

options OfficeIMO.Excel.ExcelReaderOptions? = null optional

Returns

Dictionary<string, int>
public IReadOnlyList<ExcelIgnoredErrorRegionInfo> GetIgnoredErrorRegions() #

Lists standard ignored-error regions without exposing Open XML types.

Returns

IReadOnlyList<ExcelIgnoredErrorRegionInfo>
public ExcelImage? GetImage(string name) #

Returns an image by non-visual drawing name, or null if it was not found.

Parameters

name string required

Returns

ExcelImage?
public IReadOnlyList<ExcelInCellImage> GetInCellImages(long maximumTotalImageBytes = 64000000) #

Reads native in-cell images with a deterministic aggregate payload budget.

Parameters

maximumTotalImageBytes long = 64000000 optional

Returns

IReadOnlyList<ExcelInCellImage>
public IReadOnlyList<int> GetManualColumnPageBreaks() #

Gets one-based worksheet columns that have a manual page break after them.

Returns

IReadOnlyList<int>
public IReadOnlyList<int> GetManualRowPageBreaks() #

Gets one-based worksheet rows that have a manual page break after them.

Returns

IReadOnlyList<int>
GetMergedRanges 2 overloads
public IReadOnlyList<ExcelMergedRangeInfo> GetMergedRanges() #

Gets worksheet merged ranges as reusable one-based A1 metadata.

Returns

IReadOnlyList<ExcelMergedRangeInfo>
public IReadOnlyList<ExcelMergedRangeInfo> GetMergedRanges(int maximumRanges) #

Gets worksheet merged ranges while rejecting collections beyond the configured inspection limit.

Parameters

maximumRanges int required
Maximum merge records inspected.

Returns

IReadOnlyList<ExcelMergedRangeInfo>
public ExcelModernChart? GetModernChart(string name) #

Returns a native or imported ChartEx drawing by non-visual name.

Parameters

name string required
public ExcelRange? GetNamedRange(string name) #

Gets the range a defined name refers to, preferring a name local to this sheet over a workbook name.

Parameters

name string required
Defined name to resolve.

Returns

ExcelRange? The range, or null when the name is missing or is not one cell range on an existing worksheet.
public ExcelCellData GetPivotData(string pivotTableName, string dataField, IReadOnlyDictionary<string, object?>? items = null) #

Reads a value from a saved pivot view, without refreshing its source or cache. Supports saved hierarchies, qualified date, numeric and manual text groups, default subtotals, collapsed groups and multiple measures. Unknown fields, items, measures or pivots return a typed #REF! error.

Parameters

pivotTableName string required
Saved pivot definition on this worksheet.
dataField string required
Measure caption or unique source field name.
items System.Collections.Generic.IReadOnlyDictionary<string, object?>? = null optional
Field criteria. Dates accept DateTime or workbook serials; error items use an ExcelCellData error, distinct from text with the same spelling.

Exceptions

  • NotSupportedException – The view has no materialized items or uses an unsupported layout or exceeds lookup limits.
public string GetPivotTableRange(string pivotTableName, ExcelPivotRangeTarget target = WholeTable) #

Resolves the output range for a pivot table on this worksheet.

Parameters

pivotTableName string required
target OfficeIMO.Excel.ExcelPivotRangeTarget = WholeTable optional

Returns

string
public IReadOnlyList<ExcelPivotTableInfo> GetPivotTables() #

Returns pivot tables defined on this worksheet.

Returns

IReadOnlyList<ExcelPivotTableInfo>
public ValueTuple<int, int, int, int> GetRangeBounds(string a1) #

Parses an A1 range and returns 1-based bounds (r1, c1, r2, c2).

Parameters

a1 string required
A1 range without a sheet prefix (e.g., "A2:D20").

Returns

ValueTuple<int, int, int, int> Tuple of (r1, c1, r2, c2) with normalized bounds.

Exceptions

  • ArgumentException – Thrown when the input is not a valid A1 range.
public ValueTuple<OfficeLength, OfficeLength> GetRangeSize(string range) #

Returns the authored dimensions of an A1 range using current column widths, row heights and hidden cells.

Parameters

range string required

Returns

ValueTuple<OfficeLength, OfficeLength>
public IReadOnlyList<ExcelRowInfo> GetRowDefinitions() #

Gets explicit worksheet row definitions such as custom heights and hidden rows.

Returns

IReadOnlyList<ExcelRowInfo>
public IReadOnlyList<ExcelSparklineInfo> GetSparklines() #

Lists authored worksheet sparklines in package order.

Returns

IReadOnlyList<ExcelSparklineInfo>
public string? GetTableRange(string tableName) #

Gets the A1 range covered by a table on this worksheet.

Parameters

tableName string required
Table name or display name.

Returns

string? The table reference, or null when no matching table exists.
public IReadOnlyList<ExcelTableInfo> GetTables() #

Returns the named Excel table definitions owned by this worksheet. Ordinary cell grids are not named tables. Metadata is read through the same locked snapshot owner as ExcelDocument.GetTables.

Returns

IReadOnlyList<ExcelTableInfo>

Exceptions

  • InvalidOperationException – The worksheet was removed or no longer belongs to the current workbook package.
public ExcelThreadedCommentInfo? GetThreadedComment(string id) #

Gets a threaded comment or reply by id, or null when it is not present on this worksheet.

Parameters

id string required
public IReadOnlyList<ExcelThreadedCommentInfo> GetThreadedComments() #

Gets all threaded comments and replies on this worksheet.

Returns

IReadOnlyList<ExcelThreadedCommentInfo>
public void GroupColumns(int startColumn, int endColumn, byte outlineLevel = 1, bool collapsed = false, bool hidden = false) #

Groups a contiguous range of worksheet columns by applying an Excel outline level.

Parameters

startColumn int required
First 1-based column in the group.
endColumn int required
Last 1-based column in the group.
outlineLevel byte = 1 optional
Excel outline level from 1 through 7.
collapsed bool = false optional
Whether to hide the grouped columns and mark the summary column as collapsed.
hidden bool = false optional
Whether to hide the grouped columns without marking the group as collapsed.
public void GroupRows(int startRow, int endRow, byte outlineLevel = 1, bool collapsed = false, bool hidden = false) #

Groups a contiguous range of worksheet rows by applying an Excel outline level.

Parameters

startRow int required
First 1-based row in the group.
endRow int required
Last 1-based row in the group.
outlineLevel byte = 1 optional
Excel outline level from 1 through 7.
collapsed bool = false optional
Whether to hide the grouped rows and mark the summary row as collapsed.
hidden bool = false optional
Whether to hide the grouped rows without marking the group as collapsed.
public bool HasComment(int row, int column) #

Returns true when a comment exists for the specified cell.

Parameters

row int required
1-based row index.
column int required
1-based column index.

Returns

bool
public ExcelMutationResult InsertCells(string range, ExcelCellShiftDirection direction, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default) #

Transactionally inserts cells.

Parameters

range string required
direction OfficeIMO.Excel.ExcelCellShiftDirection required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void InsertColumns(int firstColumn, int count = 1) #

Inserts blank worksheet columns immediately before firstColumn and shifts existing columns right. Formulas, defined names, tables, merges, comments, hyperlinks, validations, conditional formatting, drawings, page breaks and connection parameters are adjusted where supported. Use ExcelSheet.InsertColumnsTransactional for rollback and post-edit diagnostics.

Parameters

firstColumn int required
count int = 1 optional

Exceptions

  • ArgumentOutOfRangeException – The requested columns fall outside the worksheet column limit.
  • InvalidOperationException – Content or a dependent reference would exceed the column limit, or the insertion would split an array formula, data table or PivotTable output range, or the worksheet contains unsupported controls.
public ExcelMutationResult InsertColumnsTransactional(int firstColumn, int count = 1, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default) #

Plans and transactionally inserts columns with bounded rollback and post-edit diagnostics.

Parameters

firstColumn int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public string InsertDataReader(IDataReader reader, int startRow = 1, int startColumn = 1, bool includeHeaders = true, string? tableName = null, ExcelTableStyle style = TableStyleMedium2, bool includeAutoFilter = true, bool createTable = true, bool autoFit = false, CancellationToken ct = default) #

Streams rows from an IDataReader (including provider-owned DbDataReader implementations) into the worksheet and optionally creates an Excel table. The caller owns the connection, command, query, and provider. Null and DBNull values remain blank cells; an empty string remains text.

Parameters

reader System.Data.IDataReader required
Open data reader positioned before the first row.
startRow int = 1 optional
1-based start row.
startColumn int = 1 optional
1-based start column.
includeHeaders bool = true optional
Write field names as the first row.
tableName string? = null optional
Optional Excel table name.
style OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium2 optional
Excel table style to use when createTable is true.
includeAutoFilter bool = true optional
Include table AutoFilter dropdowns when creating a table.
createTable bool = true optional
Create an Excel table over the imported range.
autoFit bool = false optional
Auto-fit imported columns after rows are written.
ct System.Threading.CancellationToken = default optional
Cancellation token.

Returns

string A1 range occupied by the imported reader data.
public ExcelDataReaderInsertResult InsertDataReaderWithResult(IDataReader reader, int startRow = 1, int startColumn = 1, bool includeHeaders = true, string? tableName = null, ExcelTableStyle style = TableStyleMedium2, bool includeAutoFilter = true, bool createTable = true, bool autoFit = false, CancellationToken ct = default) #

Streams rows from an IDataReader into the worksheet and returns the occupied range, actual table name, and imported dimensions.

Parameters

reader System.Data.IDataReader required
Open data reader positioned before the first row.
startRow int = 1 optional
1-based start row.
startColumn int = 1 optional
1-based start column.
includeHeaders bool = true optional
Write field names as the first row.
tableName string? = null optional
Optional Excel table name.
style OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium2 optional
Excel table style to use when createTable is true.
includeAutoFilter bool = true optional
Include table AutoFilter dropdowns when creating a table.
createTable bool = true optional
Create an Excel table over the imported range.
autoFit bool = false optional
Auto-fit imported columns after rows are written.
ct System.Threading.CancellationToken = default optional
Cancellation token.

Returns

ExcelDataReaderInsertResult Details of the imported rows and the actual table created by OfficeIMO.
public void InsertRows(int firstRow, int count = 1) #

Inserts blank worksheet rows immediately before firstRow and shifts existing rows down. Formulas, defined names, tables, merges, comments, hyperlinks, validations, conditional formatting, sparklines, drawings, and chart references owned by the workbook are adjusted where supported.

Parameters

firstRow int required
The 1-based row before which new rows are inserted.
count int = 1 optional
The number of rows to insert.

Exceptions

  • ArgumentOutOfRangeException – Thrown when the requested rows fall outside the worksheet row limit.
  • InvalidOperationException – Thrown when content or a dependent reference would exceed the worksheet row limit, or when the insertion would split an array formula, data-table, or PivotTable output range, when the workbook uses R1C1 reference mode, or when the worksheet contains unsupported form controls, OLE objects, or single-cell XML mappings.
public ExcelMutationResult InsertRowsTransactional(int firstRow, int count = 1, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default) #

Plans and transactionally inserts rows with bounded rollback and post-edit diagnostics.

Parameters

firstRow int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ExcelFormulaInspection InspectFormulas() #

Inspects formula cells on this sheet without changing workbook contents.

InspectTemplate 3 overloads
public ExcelTemplateInspection InspectTemplate() #

Inspects {{Marker}} placeholders on this worksheet without modifying it.

public ExcelTemplateInspection InspectTemplate(IDictionary<string, object?> values) #

Inspects {{Marker}} placeholders on this worksheet and reports which markers are missing from the supplied values.

Parameters

values System.Collections.Generic.IDictionary<string, object?> required
public ExcelTemplateInspection InspectTemplate(object model) #

Inspects {{Marker}} placeholders on this worksheet and reports which markers are missing from public properties on the supplied model.

Parameters

model object required
public void InvalidateFormulas() #

Marks all formula cells on this sheet dirty.

public static bool IsSupportedImageContentType(string? contentType) #

Determines whether an image content type can be stored in an Excel image part.

Parameters

contentType string? required
The MIME content type to inspect.

Returns

bool true when the content type maps to an Excel image part; otherwise false.
public ExcelLinkByHeaderResult LinkByHeader(string header, ExcelLinkTarget target, ExcelLinkByHeaderOptions? options = null) #

Turns each non-empty cell under a header into a link to a worksheet or URL built from the cell text.

Parameters

header string required
Header text of the column to link (case-insensitive).
target OfficeIMO.Excel.ExcelLinkTarget required
Where each cell points: ExcelLinkTarget.Sheet or ExcelLinkTarget.Url.
options OfficeIMO.Excel.ExcelLinkByHeaderOptions? = null optional
Optional range or table scope, row bounds, display text and styling.

Returns

ExcelLinkByHeaderResult The linked column and count, the skipped cells, or why nothing was linked.

Examples

sheet.LinkByHeader("Domain", ExcelLinkTarget.Sheet()); sheet.LinkByHeader("RFC", ExcelLinkTarget.Url(rfc => $"https://datatracker.ietf.org/doc/html/{rfc}"), new ExcelLinkByHeaderOptions { Table = "Summary" });

public void LinkCellsToInternalSheets(string a1, Func<string, string> destinationSheetForCellText, string targetA1 = "A1", Func<string, string>? display = null, bool styled = true) #

Converts each non-empty cell in the A1 range into an internal hyperlink. The destination sheet name is computed from the cell's text using destinationSheetForCellText.

Parameters

a1 string required
A1 range to process (e.g., a column of names).
destinationSheetForCellText System.Func<string, string> required
Maps the cell text to a destination sheet name.
targetA1 string = "A1" optional
Destination cell on the target sheet (default "A1").
display System.Func<string, string>? = null optional
Optional display text selector. Defaults to the cell text.
styled bool = true optional
When true, applies hyperlink styling (blue + underline).

Examples

sheet.ForEachColumn("A1:E1", c => sheet.CellBold(1, c, true));

public ExcelPivotMaterializationResult MaterializePivotTable(string pivotTableName, ExcelMutationPlanOptions? options = null, CancellationToken cancellationToken = default, DateTime? referenceDate = null) #

Generates saved pivot views and their shared source cache from current worksheet values. Supports up to 256 measures and fields across ordinary, numeric-range, derived date and manual text group axes, selected page items, hidden row, column, or page items, deterministic first-seen key order, and optional grand totals. Source formulas use their saved typed caches.

Parameters

pivotTableName string required
Pivot definition on this worksheet.
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
Source, measure-input, output and rollback limits. Each cell/work budget uses MaximumAffectedCells, capped at one million.
cancellationToken System.Threading.CancellationToken = default optional
Cancels preparation or rolls back an interrupted write.
referenceDate System.DateTime? = null optional
Local calendar date used for relative date filters. Defaults to today's date, captured once for all shared-cache views.

Exceptions

  • NotSupportedException – A cache view uses an unqualified grouping, filter, calculated field, measure layout, or incompatible cache representation.
  • InvalidOperationException – A budget or destination collision prevents generation.
public ExcelStructuralMutationPlan PlanCopyRange(string sourceRange, string destinationTopLeft, ExcelMutationPlanOptions? options = null) #

Plans a formula-aware cell-range copy.

Parameters

sourceRange string required
destinationTopLeft string required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelStructuralMutationPlan PlanDeleteCells(string range, ExcelCellShiftDirection direction, ExcelMutationPlanOptions? options = null) #

Plans deletion of a rectangular cell block.

Parameters

range string required
direction OfficeIMO.Excel.ExcelCellShiftDirection required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelStructuralMutationPlan PlanDeleteColumns(int firstColumn, int count = 1, ExcelMutationPlanOptions? options = null) #

Builds a bounded dry-run plan for deleting complete worksheet columns.

Parameters

firstColumn int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelRowMutationPlan PlanDeleteRows(int firstRow, int count = 1, ExcelMutationPlanOptions? options = null) #

Validates and describes a deletion without changing the workbook.

Parameters

firstRow int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelStructuralMutationPlan PlanInsertCells(string range, ExcelCellShiftDirection direction, ExcelMutationPlanOptions? options = null) #

Plans insertion of a rectangular cell block.

Parameters

range string required
direction OfficeIMO.Excel.ExcelCellShiftDirection required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelStructuralMutationPlan PlanInsertColumns(int firstColumn, int count = 1, ExcelMutationPlanOptions? options = null) #

Builds a bounded dry-run plan for inserting complete worksheet columns.

Parameters

firstColumn int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelRowMutationPlan PlanInsertRows(int firstRow, int count = 1, ExcelMutationPlanOptions? options = null) #

Validates and describes an insertion without changing the workbook.

Parameters

firstRow int required
count int = 1 optional
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelStructuralMutationPlan PlanMoveRange(string sourceRange, string destinationTopLeft, ExcelMutationPlanOptions? options = null) #

Plans a formula-aware cell-range move.

Parameters

sourceRange string required
destinationTopLeft string required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public ExcelStructuralMutationPlan PlanTransposeRange(string sourceRange, string destinationTopLeft, ExcelMutationPlanOptions? options = null) #

Plans a formula-aware transposed copy.

Parameters

sourceRange string required
destinationTopLeft string required
options OfficeIMO.Excel.ExcelMutationPlanOptions? = null optional
public void Protect(ExcelSheetProtectionOptions? options = null) #

Applies worksheet protection using the provided options.

Parameters

options OfficeIMO.Excel.ExcelSheetProtectionOptions? = null optional
Protection options (defaults allow selection of locked/unlocked cells).
public void ProtectTableEditing(string? password = null) #

Applies worksheet protection with permissions for common Excel table editing workflows.

Parameters

password string? = null optional
Range 2 overloads
public ExcelRange Range(string a1Range) #

Returns a range by A1 address, such as A1:V1. A single cell reference returns a one-cell range.

Parameters

a1Range string required

Returns

ExcelRange
public ExcelRange Range(int firstRow, int firstColumn, int lastRow, int lastColumn) #

Returns the range between two 1-based corner cells.

Parameters

firstRow int required
firstColumn int required
lastRow int required
lastColumn int required

Returns

ExcelRange

Exceptions

  • ArgumentOutOfRangeException – A corner is outside the worksheet or the corners are reversed.
public int RecalculateSupportedFormulas() #

Evaluates supported formulas on this sheet and writes cached results.

Returns

int
public void RefreshHeaderCache(ExcelReaderOptions? options = null) #

Forces rebuilding the header map for the current UsedRange and options.

Parameters

options OfficeIMO.Excel.ExcelReaderOptions? = null optional
public bool RemoveAllowedEditRange(string name) #

Removes a named allowed-edit region.

Parameters

name string required

Returns

bool
public void RemoveConditionalFormattingRule(ExcelConditionalFormattingInfo rule) #

Removes one attached conditional-formatting rule.

Parameters

rule OfficeIMO.Excel.ExcelConditionalFormattingInfo required
public void RemoveDataValidations(string? a1Range = null) #

Removes data validation rules, optionally restricted to a range.

Parameters

a1Range string? = null optional
public int RemoveIgnoredErrorRegions(string range) #

Removes every standard ignored-error region overlapping the supplied A1 cell or range.

Parameters

range string required

Returns

int
public bool RemoveInCellImage(int row, int column) #

Removes the in-cell image value from one cell. Shared rich-data assets remain available to copied cells.

Parameters

row int required
column int required

Returns

bool
public bool RemoveManualColumnPageBreak(int column, bool save = true) #

Removes a manual worksheet column page break.

Parameters

column int required
save bool = true optional

Returns

bool
public bool RemoveManualRowPageBreak(int row, bool save = true) #

Removes a manual worksheet row page break.

Parameters

row int required
save bool = true optional

Returns

bool
public bool RemoveNamedRange(string name, bool save = true) #

Removes a defined name scoped to this sheet.

Parameters

name string required
Defined name to remove.
save bool = true optional
When true, saves the workbook after removal.

Returns

bool True if removed; false if not found.
public int RemoveSparklines(string locationRange) #

Removes every sparkline whose destination intersects a range and prunes empty groups.

Parameters

locationRange string required

Returns

int
public int RemoveTemplateOptionalRows(int firstRow, int rowCount) #

Removes an optional worksheet row block and shifts following worksheet rows up.

Parameters

firstRow int required
1-based first row in the optional block.
rowCount int required
Number of rows in the optional block.

Returns

int
public bool RemoveThreadedComment(string id, bool removeReplies = true) #

Removes a threaded comment. Root-comment removal includes its reply tree by default.

Parameters

id string required
Threaded comment id.
removeReplies bool = true optional
Whether replies and imported descendant replies should be removed with the comment.

Returns

bool
public int RemoveThreadedCommentsAt(string address) #

Removes every threaded comment and reply attached to a worksheet cell.

Parameters

address string required

Returns

int
public string RenameTable(string tableOrRange, string newName, ExcelTableNameValidationMode validationMode = Strict) #

Renames a table and every parsed structured reference to it across the workbook.

Parameters

tableOrRange string required
newName string required
validationMode OfficeIMO.Excel.ExcelTableNameValidationMode = Strict optional

Returns

string
public void ReorderConditionalFormattingRules(IReadOnlyList<ExcelConditionalFormattingInfo> orderedRules) #

Reassigns consecutive priorities in the supplied order. The sequence must contain every currently attached rule exactly once.

Parameters

orderedRules System.Collections.Generic.IReadOnlyList<OfficeIMO.Excel.ExcelConditionalFormattingInfo> required
public int ReplaceAll(string oldText, string newText) #

Replaces all occurrences of oldText with newText in string cells. Returns the number of replacements performed.

Parameters

oldText string required
newText string required

Returns

int
public ExcelThreadedCommentResult ReplyToThreadedComment(string parentId, string text, string author = "OfficeIMO", DateTime? date = null, string? id = null) #

Adds a reply using the worksheet and cell of an existing root threaded comment.

Parameters

parentId string required
text string required
author string = "OfficeIMO" optional
date System.DateTime? = null optional
id string? = null optional
public ExcelReportBuilder Report(ExcelReportOptions? options = null) #

Starts a report builder on this worksheet. Existing cells are retained until report content writes them.

Parameters

options OfficeIMO.Excel.ExcelReportOptions? = null optional
public IReadOnlyList<ExcelTableColumnInfo> ResizeTable(string tableOrRange, string newRange) #

Resizes a table while retaining its current ordered column names.

Parameters

tableOrRange string required
newRange string required

Returns

IReadOnlyList<ExcelTableColumnInfo>
RowsAsParallel``1 6 overloads
public IEnumerable<T> RowsAsParallel<T>(ParallelRowMappingOptions? parallelOptions = null, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Projects the used range in bounded parallel batches by matching headers to writable public properties. The worksheet reader remains single-owner and results retain source order.

Type Parameters

T

Parameters

parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T>
public IEnumerable<T> RowsAsParallel<T>(Action<RowMapper<T>> configure, ParallelRowMappingOptions? parallelOptions = null, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Projects the used range in bounded parallel batches with explicit, AOT-friendly assignments.

Type Parameters

T

Parameters

configure System.Action<OfficeIMO.Data.RowMapper<T>> required
parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T>
public IEnumerable<T> RowsAsParallel<T>(Func<IDataRecord, T> factory, ParallelRowMappingOptions? parallelOptions = null, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Projects the used range in bounded parallel batches with a caller-supplied factory.

Type Parameters

T

Parameters

factory System.Func<System.Data.IDataRecord, T> required
parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T>
public IEnumerable<T> RowsAsParallel<T>(string a1Range, ParallelRowMappingOptions? parallelOptions = null, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Projects an A1 range in bounded parallel batches by matching its first row to writable public properties. Results retain source order.

Type Parameters

T

Parameters

a1Range string required
parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T>
public IEnumerable<T?> RowsAsParallel<T>(string a1Range, Action<RowMapper<T?>> configure, ParallelRowMappingOptions? parallelOptions = null, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Projects an A1 range in bounded parallel batches with explicit, AOT-friendly assignments.

Type Parameters

T

Parameters

a1Range string required
configure System.Action<OfficeIMO.Data.RowMapper<T?>> required
parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T?>
public IEnumerable<T?> RowsAsParallel<T>(string a1Range, Func<IDataRecord, T?> factory, ParallelRowMappingOptions? parallelOptions = null, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Projects an A1 range in bounded parallel batches with a caller-supplied factory.

Type Parameters

T

Parameters

a1Range string required
factory System.Func<System.Data.IDataRecord, T?> required
parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T?>
RowsAs``1 6 overloads
public IEnumerable<T> RowsAs<T>(ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the sheet's used range as instances of T using header-to-property mapping. Enumerate the returned sequence while the owning ExcelDocument remains open.

Type Parameters

T

Parameters

options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<T>
public IEnumerable<T?> RowsAs<T>(Action<RowMapper<T?>> configure, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the sheet's used range as instances of T using explicit, AOT-friendly column assignments. Enumerate the returned sequence while the owning ExcelDocument remains open.

Type Parameters

T

Parameters

configure System.Action<OfficeIMO.Data.RowMapper<T?>> required
Configures the column assignments.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<T?>
public IEnumerable<T?> RowsAs<T>(Func<IDataRecord, T?> factory, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the sheet's used range with a caller-supplied factory. This overload supports constructor-bound and other models without a public parameterless constructor. Enumerate the returned sequence while the owning ExcelDocument remains open.

Type Parameters

T

Parameters

factory System.Func<System.Data.IDataRecord, T?> required
Creates one model instance from the current row.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<T?>
public IEnumerable<T?> RowsAs<T>(string a1Range, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the specified A1 range as instances of T using header-to-property mapping. Enumerate the returned sequence while the owning ExcelDocument remains open.

Type Parameters

T

Parameters

a1Range string required
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<T?>
public IEnumerable<T?> RowsAs<T>(string a1Range, Action<RowMapper<T?>> configure, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the specified A1 range as instances of T using explicit, AOT-friendly column assignments. Enumerate the returned sequence while the owning ExcelDocument remains open.

Type Parameters

T

Parameters

a1Range string required
Inclusive A1 range containing the header and data rows.
configure System.Action<OfficeIMO.Data.RowMapper<T?>> required
Configures the column assignments.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<T?>
public IEnumerable<T?> RowsAs<T>(string a1Range, Func<IDataRecord, T?> factory, ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams the specified A1 range with a caller-supplied factory. This overload supports constructor-bound and other models without a public parameterless constructor. Enumerate the returned sequence while the owning ExcelDocument remains open.

Type Parameters

T

Parameters

a1Range string required
Inclusive A1 range containing the header and data rows.
factory System.Func<System.Data.IDataRecord, T?> required
Creates one model instance from the current row.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Optional read options.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation token observed during enumeration.

Returns

IEnumerable<T?>
SaveAsImage 2 overloads
public OfficeConversionReport SaveAsImage(string path, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Writes the worksheet to a file and returns its fidelity report.

Parameters

path string required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeConversionReport
public OfficeConversionReport SaveAsImage(Stream stream, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Writes the worksheet to a caller-owned stream and returns its fidelity report.

Parameters

stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeConversionReport
SaveAsImageAsync 2 overloads
public async Task<OfficeConversionReport> SaveAsImageAsync(string path, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously writes the worksheet to a file and returns its fidelity report.

Parameters

path string required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<OfficeConversionReport>
public async Task<OfficeConversionReport> SaveAsImageAsync(Stream stream, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously writes the worksheet to a caller-owned stream and returns its fidelity report.

Parameters

stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<OfficeConversionReport>
public OfficeConversionReport SaveAsImages(string folderPath, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Saves the selected worksheet images without retaining their encoded payloads, and returns an aggregate report.

Parameters

folderPath string required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeConversionReport
public async Task<OfficeConversionReport> SaveAsImagesAsync(string folderPath, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously saves the selected worksheet images without retaining payloads, and returns an aggregate report.

Parameters

folderPath string required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<OfficeConversionReport>
public IReadOnlyList<ExcelFormulaCellInfo> SearchFormulas(ExcelFormulaSearchOptions options) #

Searches formula text, function calls, or parsed references on this worksheet.

Parameters

options OfficeIMO.Excel.ExcelFormulaSearchOptions required

Returns

IReadOnlyList<ExcelFormulaCellInfo>
public void SetAllowedEditRange(string name, IEnumerable<string> ranges, string? password = null, string? securityDescriptor = null) #

Adds or replaces a named allowed-edit region on a protected worksheet.

Parameters

name string required
ranges System.Collections.Generic.IEnumerable<string> required
password string? = null optional
securityDescriptor string? = null optional
public void SetArrayFormula(string a1Range, string formula) #

Sets a shared-free array formula over a range. The top-left cell owns the formula metadata.

Parameters

a1Range string required
formula string required
public void SetByHeader(int rowIndex, string header, object? value, ExcelReaderOptions? options = null) #

Sets a cell value in the specified row by resolving the column using the header name. Does nothing when the header cannot be found.

Parameters

rowIndex int required
header string required
value object? required
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
public void SetColumnHidden(int columnIndex, bool hidden) #

Hides or shows the specified column.

Parameters

columnIndex int required
1-based column index.
hidden bool required
True to hide the column; false to show it.
public void SetColumnOutline(int columnIndex, byte outlineLevel, bool collapsed = false, bool save = true) #

Sets column outline metadata used by Excel grouping.

Parameters

columnIndex int required
One-based column index.
outlineLevel byte required
Outline level from 0 through 7.
collapsed bool = false optional
Whether the column is shown as collapsed.
save bool = true optional
Whether to save the worksheet XML immediately.
public void SetColumnWidth(int columnIndex, ExcelColumnWidth width) #

Sets the width of the specified column.

Parameters

columnIndex int required
1-based column index.
width OfficeIMO.Excel.ExcelColumnWidth required
The column width.
public void SetColumnWidths(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> required
Widths keyed by 1-based column index. Widths above 255 are clamped.

Exceptions

  • ArgumentNullException – The width map is null.
  • ArgumentOutOfRangeException – An index is outside the worksheet or a width is non-positive or non-finite.
SetComment 2 overloads
public void SetComment(int row, int column, string text, string author = "OfficeIMO", string? initials = null) #

Adds or replaces a comment on the specified cell.

Parameters

row int required
1-based row index.
column int required
1-based column index.
text string required
Comment text.
author string = "OfficeIMO" optional
Author name (optional).
initials string? = null optional
Author initials (optional).
public void SetComment(string a1, string text, string author = "OfficeIMO", string? initials = null) #

Adds or replaces a comment on the specified A1 cell reference.

Parameters

a1 string required
A1 cell reference (e.g., "B5").
text string required
Comment text.
author string = "OfficeIMO" optional
Author name (optional).
initials string? = null optional
Author initials (optional).
SetCommentRichText 2 overloads
public void SetCommentRichText(int row, int column, IEnumerable<ExcelRichTextRun> runs, string author = "OfficeIMO", string? initials = null) #

Adds or replaces a rich-text comment on the specified cell.

Parameters

row int required
1-based row index.
column int required
1-based column index.
runs System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelRichTextRun> required
Rich text runs that make up the comment text.
author string = "OfficeIMO" optional
Author name (optional).
initials string? = null optional
Author initials (optional).
public void SetCommentRichText(string a1, IEnumerable<ExcelRichTextRun> runs, string author = "OfficeIMO", string? initials = null) #

Adds or replaces a rich-text comment on the specified A1 cell reference.

Parameters

a1 string required
A1 cell reference (e.g., "B5").
runs System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelRichTextRun> required
Rich text runs that make up the comment text.
author string = "OfficeIMO" optional
Author name (optional).
initials string? = null optional
Author initials (optional).
public ExcelConditionalFormattingInfo SetConditionalFormattingColors(ExcelConditionalFormattingInfo rule, OfficeColor? color = null, OfficeColor? fillColor = null) #

Sets supplied text and solid-fill colors on an attached conditional rule, preserving its other native styling. Returns a fresh editable snapshot. If both colors are omitted, applies the creation theme's Danger text and light Danger fill. When one color is supplied, the other remains unchanged. Native theme roles stay linked to the workbook.

Parameters

rule OfficeIMO.Excel.ExcelConditionalFormattingInfo required
color OfficeIMO.OfficeColor? = null optional
fillColor OfficeIMO.OfficeColor? = null optional
public void SetDataValidationMessages(string a1Range, ExcelDataValidationMessageOptions options) #

Applies prompt/error-message metadata to existing validations that overlap the range.

Parameters

a1Range string required
options OfficeIMO.Excel.ExcelDataValidationMessageOptions required
public void SetDefaultColumnWidth(ExcelColumnWidth width, bool save = true) #

Sets the worksheet default column width from characters or a physical length.

Parameters

width OfficeIMO.Excel.ExcelColumnWidth required
Default column width. Excel supports resolved widths up to 255 character units.
save bool = true optional
Whether to save the worksheet XML immediately.
public void SetDefaultRowHeight(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 required
Default row height. Excel supports physical heights up to 409 points.
hidden bool = false optional
Whether empty rows should be hidden by default.
save bool = true optional
Whether to save the worksheet XML immediately.
public void SetDynamicArrayFormula(string a1Cell, string formula) #

Authors a dynamic array at one anchor cell. Calculation determines its bounded spill range.

Parameters

a1Cell string required
formula string required
public void SetHidden(bool hidden) #

Hides or shows the worksheet in the workbook.

Parameters

hidden bool required
SetHyperlink 4 overloads
public void SetHyperlinkHost(int row, int column, string url, bool style = true) #

Creates an external hyperlink showing only the host (e.g., example.org) as display text.

Parameters

row int required
1-based row index.
column int required
1-based column index.
url string required
Target URL.
style bool = true optional
When true, applies hyperlink styling (blue + underline).

Examples

sheet.SetHyperlinkSmart(5, 1, "https://datatracker.ietf.org/doc/html/rfc7208"); // displays "RFC 7208" sheet.SetHyperlinkSmart(6, 1, "https://example.org/path", title: "Spec"); // displays "Spec"

public void SetHyperlinkReference(int row, int column, string url, bool style = true, string? tooltip = null) #

Attaches an external hyperlink to an existing cell without replacing its value or rich-text runs.

Parameters

row int required
1-based row index.
column int required
1-based column index.
url string required
Target URL.
style bool = true optional
When true, applies the cell-level hyperlink style.
tooltip string? = null optional
Optional ScreenTip text shown by spreadsheet applications.
public void SetHyperlinkSmart(int row, int column, string url, string? title = null, bool style = true) #

Creates an external hyperlink using a smart display strategy: prefer title, then an RFC label (e.g., "RFC 7208") when detected, otherwise the URL host.

Parameters

row int required
1-based row index.
column int required
1-based column index.
url string required
Target URL.
title string? = null optional
Optional preferred display text.
style bool = true optional
When true, applies hyperlink styling (blue + underline).

Examples

// Given a summary table where column A contains sheet names, link each cell to its sheet sheet.LinkCellsToInternalSheets("A2:A51", text => text, targetA1: "A1", styled: true);

public ExcelInCellImage SetInCellImage(int row, int column, byte[] imageBytes, string contentType = "image/png", string? altText = null, long maximumImageBytes = 32000000) #

Adds or replaces a native in-cell image without creating a drawing anchor.

Parameters

row int required
column int required
imageBytes byte[] required
contentType string = "image/png" optional
altText string? = null optional
maximumImageBytes long = 32000000 optional
SetInternalLink 4 overloads
public void SetNamedFormula(string name, string formula, bool save = true, bool hidden = false, ExcelDefinedNameValidationMode validationMode = Sanitize) #

Creates or replaces a formula definition scoped to this worksheet.

Parameters

name string required
The defined name used by worksheet formulas.
formula string required
An Excel expression, with or without a leading equals sign.
save bool = true optional
Whether to persist the workbook change immediately.
hidden bool = false optional
Whether to hide the name in Excel's normal name list.
validationMode OfficeIMO.Excel.ExcelDefinedNameValidationMode = Sanitize optional
How the defined name is validated or sanitized.
SetNamedRange 2 overloads
public void SetNamedRange(string name, string range, bool save = true, bool hidden = false) #

Creates or updates a named range in the workbook, scoped to this sheet.

Parameters

name string required
Defined name to create or update.
range string required
A1 range (e.g. "A1:B5").
save bool = true optional
When true, saves the workbook after the change.
hidden bool = false optional
When true, marks the defined name as hidden.
public void SetNamedRange(string name, string range, bool save, bool hidden, ExcelDefinedNameValidationMode validationMode) #

Creates or updates a named range in the workbook, scoped to this sheet, with validation control.

Parameters

name string required
Defined name to create or update.
range string required
A1 range (e.g. "A1:B5").
save bool required
When true, saves the workbook after the change.
hidden bool required
When true, marks the defined name as hidden.
validationMode OfficeIMO.Excel.ExcelDefinedNameValidationMode required
Controls how the name and range are validated: Sanitize (default) clamps/adjusts; Strict throws on invalid input.
public void SetOutlineSummary(bool? summaryBelow = null, bool? summaryRight = null) #

Configures the worksheet outline summary positions shown by Excel.

Parameters

summaryBelow bool? = null optional
Whether row summaries should appear below grouped rows.
summaryRight bool? = null optional
Whether column summaries should appear to the right of grouped columns.
public void SetRowHeight(int rowIndex, ExcelColumnWidth height) #

Sets the explicit height of the specified row. Use a non-positive height to clear the custom row height.

Parameters

rowIndex int required
1-based row index.
height OfficeIMO.Excel.ExcelColumnWidth required
Row height as characters or a physical length.
public void SetRowHidden(int rowIndex, bool hidden) #

Sets whether the specified row is hidden.

Parameters

rowIndex int required
1-based row index.
hidden bool required
True to hide the row; false to show it.
public void SetRowLayout(int rowIndex, ExcelRowLayoutOptions options) #

Applies reusable row layout and row-wide cell style options to one worksheet row.

Parameters

rowIndex int required
The 1-based row index to update.
options OfficeIMO.Excel.ExcelRowLayoutOptions required
The layout options to apply.
public void SetRowOutline(int rowIndex, byte outlineLevel, bool collapsed = false, bool save = true) #

Sets row outline metadata used by Excel grouping.

Parameters

rowIndex int required
One-based row index.
outlineLevel byte required
Outline level from 0 through 7.
collapsed bool = false optional
Whether the row is shown as collapsed.
save bool = true optional
Whether to save the worksheet XML immediately.
public void SetRowsLayout(IEnumerable<int> rowIndexes, ExcelRowLayoutOptions options) #

Applies the same reusable row layout and row-wide cell style options to multiple worksheet rows.

Parameters

rowIndexes System.Collections.Generic.IEnumerable<int> required
The 1-based row indexes to update.
options OfficeIMO.Excel.ExcelRowLayoutOptions required
The layout options to apply.
public int SetSparklineType(string locationRange, ExcelSparklineType type) #

Changes the type of every sparkline whose destination intersects a range.

Parameters

locationRange string required
type OfficeIMO.Excel.ExcelSparklineType required

Returns

int
public void SetTabColor(OfficeColor color) #

Sets a literal or theme-based worksheet tab color.

Parameters

color OfficeIMO.OfficeColor required
A literal RGBA color, native theme role or status color.
public IReadOnlyList<ExcelTableColumnInfo> SetTableSchema(string tableOrRange, IReadOnlyList<string> columnNames, string? newRange = null) #

Replaces the ordered table-column schema and optionally resizes the table. The table's top-left cell remains fixed; callers retain control of data outside the new table rectangle.

Parameters

tableOrRange string required
columnNames System.Collections.Generic.IReadOnlyList<string> required
newRange string? = null optional

Returns

IReadOnlyList<ExcelTableColumnInfo>
public void SetTableStyle(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 required
Table range, name, or display name.
style OfficeIMO.Excel.ExcelTableStyle required
Table style to apply.
showFirstColumn bool? = null optional
Optional first-column emphasis flag.
showLastColumn bool? = null optional
Optional last-column emphasis flag.
showRowStripes bool? = null optional
Optional row stripe flag.
showColumnStripes bool? = null optional
Optional column stripe flag.
public void SetTableTotals(string range, Dictionary<string, ExcelTableTotalsFunction> byHeader) #

Enables a totals row for the table covering range and assigns per-column functions by header name. Supported functions are those in TotalsRowFunctionValues (Sum, Average, Count, Min, Max, etc.) except Custom, which needs a formula. A later call rewrites generated cells; formulas and values written by the caller are kept.

Parameters

range string required
Address of the table range (for example, "A1:D10") whose totals row should be displayed.
byHeader System.Collections.Generic.Dictionary<string, OfficeIMO.Excel.ExcelTableTotalsFunction> required
Mapping of table header names to the totals function that should be applied for each column.
public void SetTableTotalsByName(string tableName, IDictionary<string, ExcelTableTotalsFunction> byHeader) #

Enables a totals row for the named table and assigns per-column functions by header name.

Parameters

tableName string required
Table name or display name.
byHeader System.Collections.Generic.IDictionary<string, OfficeIMO.Excel.ExcelTableTotalsFunction> required
Mapping of table header names to totals functions.
public ExcelThreadedCommentResult SetThreadedCommentResolved(string id, bool resolved = true) #

Marks a threaded comment resolved or reopens it.

Parameters

id string required
resolved bool = true optional
public void SetValues(IEnumerable<ValueTuple<int, int, object>> cells, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Writes multiple cell values efficiently, using parallelization when beneficial.

Parameters

cells System.Collections.Generic.IEnumerable<System.ValueTuple<int, int, object>> required
Collection of cell coordinates and values.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Optional execution mode override.
ct System.Threading.CancellationToken = default optional
Cancellation token.
public void SetVeryHidden(bool veryHidden) #

Makes the worksheet very hidden, or restores it to visible.

Parameters

veryHidden bool required
Whether to set the worksheet to the very hidden workbook state.
public void SortUsedRangeByHeader(string header, bool ascending = true) #

Sorts the sheet's UsedRange rows in-place (excluding header) by the column resolved via header. Values-only: rewrites cell values; formulas and styles are not preserved. When the header cannot be resolved the sort is skipped.

Parameters

header string required
ascending bool = true optional
public void SortUsedRangeByHeaders(params ValueTuple<string, bool>[] keys) #

Sorts the sheet's UsedRange rows in-place by multiple headers in the given order (excluding header row). Values-only: rewrites cell values; formulas and styles are not preserved. Missing headers are ignored and when no valid headers remain the sort is skipped.

Parameters

keys System.ValueTuple<string, bool>[] required
public ExcelTable Table(string nameOrRange) #

Returns a lightweight object wrapper for a table by name, display name, or range.

Parameters

nameOrRange string required

Returns

ExcelTable
public DataTable TableToDataTable(string tableName, bool? headersInFirstRow = null, ExcelReaderOptions? options = null, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Reads an Excel table as a DataTable.

Parameters

tableName string required
headersInFirstRow bool? = null optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
ct System.Threading.CancellationToken = default optional

Returns

DataTable
ToDataTable 2 overloads
public DataTable ToDataTable(bool headersInFirstRow = true, ExcelReaderOptions? options = null, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Reads the worksheet used range as a DataTable.

Parameters

headersInFirstRow bool = true optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
ct System.Threading.CancellationToken = default optional

Returns

DataTable
public DataTable ToDataTable(string a1Range, bool headersInFirstRow = true, ExcelReaderOptions? options = null, ExcelExecutionMode? mode = null, CancellationToken ct = default) #

Reads an A1 range as a DataTable.

Parameters

a1Range string required
headersInFirstRow bool = true optional
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
ct System.Threading.CancellationToken = default optional

Returns

DataTable
ToImage 3 overloads
public OfficeImageExportResult ToImage(ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Renders the worksheet using the encoding in OfficeImageExportOptions.Format.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeImageExportResult
public OfficeImageExportResult ToImage(ExcelImageExportOptions? options, out OfficeConversionReport report, CancellationToken cancellationToken = default) #

Renders the worksheet and returns its immutable fidelity report.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions? required
report OfficeIMO.OfficeConversionReport required
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeImageExportResult
public OfficeImageExportResult ToImage(OfficeImageExportFormat format, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Exports a worksheet range or used range as a supported raster format or SVG.

Parameters

format OfficeIMO.Drawing.OfficeImageExportFormat required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeImageExportResult
public async Task<OfficeImageExportResult> ToImageAsync(ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Renders the worksheet with cancellation and returns the encoded image and its diagnostics.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<OfficeImageExportResult>
ToImages 3 overloads
public IReadOnlyList<OfficeImageExportResult> ToImages(ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Renders a batch using the encoding and selection in the options.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IReadOnlyList<OfficeImageExportResult>
public IReadOnlyList<OfficeImageExportResult> ToImages(OfficeImageExportFormat format, ExcelImageExportOptions? options = null) #

Exports one or more worksheet image results. Multi-area print areas and manual page-break splits are returned as separate images when requested.

Parameters

format OfficeIMO.Drawing.OfficeImageExportFormat required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional

Returns

IReadOnlyList<OfficeImageExportResult>
public void ToImages(OfficeImageExportFormat format, OfficeImageExportConsumer consumer, ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Streams worksheet image parts to a consumer without retaining earlier payloads.

Parameters

format OfficeIMO.Drawing.OfficeImageExportFormat required
consumer OfficeIMO.Drawing.OfficeImageExportConsumer required
options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public Task<IReadOnlyList<OfficeImageExportResult>> ToImagesAsync(ExcelImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Renders a batch asynchronously using the same options and evidence contract.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<IReadOnlyList<OfficeImageExportResult>>
public string ToXml(string a1Range, bool headersInFirstRow = false, ExcelXmlTableOptions? options = null, ExcelReaderOptions? readOptions = null, ExcelExecutionMode? mode = null) #

Exports a bounded A1 range as a positional or explicitly mapped XML table using cached cell values. This does not export workbook formatting or calculate formulas.

Parameters

a1Range string required
Explicit worksheet range, bounded before reading.
headersInFirstRow bool = false optional
Uses the first range row as DataTable headers rather than data.
options OfficeIMO.Excel.ExcelXmlTableOptions? = null optional
Explicit schema and resource limits.
readOptions OfficeIMO.Excel.ExcelReaderOptions? = null optional
Existing cell value, date and formula-cache read policy.
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
Existing worksheet reading execution mode.

Returns

string
public bool TryGetCachedFormulaValue(int row, int column, out string? value) #

Tries to return a formula cell's cached value, decoding string escapes while retaining numeric text precision.

Parameters

row int required
column int required
value string? required

Returns

bool
public bool TryGetCellText(int row, int column, out string text) #

Tries to read the display text of a cell at the given position. Returns false if the cell is blank or out of bounds.

Parameters

row int required
The 1-based row index of the cell to inspect.
column int required
The 1-based column index of the cell to inspect.
text string required
When this method returns, contains the extracted cell text if successful; otherwise, an empty string.

Returns

bool true if text was read successfully; otherwise, false.
public bool TryGetCellValueSnapshot(int row, int column, out ExcelNativeCellValueInfo? snapshot) #

Tries to read the native value metadata of a cell at the given position.

Parameters

row int required
The 1-based row index of the cell to inspect.
column int required
The 1-based column index of the cell to inspect.
snapshot OfficeIMO.Excel.ExcelNativeCellValueInfo? required
When this method returns, contains the cell value metadata if successful; otherwise, null.

Returns

bool true when the cell exists and carries a value, inline string, or formula.
public bool TryGetColumnIndexByHeader(string header, out int columnIndex, ExcelReaderOptions? options = null) #

Tries to resolve a 1-based column index for a given header. Returns false without throwing when the header cannot be found.

Parameters

header string required
columnIndex int required
options OfficeIMO.Excel.ExcelReaderOptions? = null optional

Returns

bool
public bool TryGetColumnRangeByHeader(string headerName, string? tableName, int headerRow, bool includeHeader, bool normalizeHeader, out string range) #

Tries to resolve the data range for a worksheet or table column by matching its header text.

Parameters

headerName string required
tableName string? required
headerRow int required
includeHeader bool required
normalizeHeader bool required
range string required

Returns

bool
public bool TryGetColumnStyleByHeader(string header, bool includeHeader, out ExcelColumnStyleByHeaderBuilder builder, out int columnIndex, ExcelReaderOptions? options = null, bool preferDirectTabularMetadata = true) #

Attempts to create a column style builder and returns the resolved 1-based column index.

Parameters

header string required
Header text used to resolve the target column after applying any configured normalization.
includeHeader bool required
True to include the header row when styling; false to begin styling from the first data row.
builder OfficeIMO.Excel.ExcelColumnStyleByHeaderBuilder required
When successful, receives a builder for the resolved column.
columnIndex int required
When successful, receives the resolved 1-based column index.
options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Read options that control header normalization and other resolution behavior.
preferDirectTabularMetadata bool = true optional
True to resolve against pending direct tabular metadata when available; false to force worksheet materialization before resolving.

Returns

bool
public void Unprotect() #

Removes worksheet protection.

public int UpdateComments(ExcelCommentFilter filter, string text, string? author = null, string? initials = null) #

Replaces the text, and optionally author, for comments that match the supplied filter.

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter required
Author, text, and/or A1 range filter used to choose comments.
text string required
Replacement comment text.
author string? = null optional
Optional replacement author.
initials string? = null optional
Optional replacement author initials.

Returns

int Number of comments updated.
public int UpdateCommentsRichText(ExcelCommentFilter filter, IEnumerable<ExcelRichTextRun> runs, string? author = null, string? initials = null) #

Replaces rich text, and optionally author, for comments that match the supplied filter.

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter required
Author, text, and/or A1 range filter used to choose comments.
runs System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelRichTextRun> required
Replacement rich text runs.
author string? = null optional
Optional replacement author.
initials string? = null optional
Optional replacement author initials.

Returns

int Number of comments updated.
public void UpdateConditionalFormattingRule(ExcelConditionalFormattingInfo rule) #

Applies the editable fields of a rule snapshot back to its attached worksheet rule. Unknown attributes and child elements are retained.

Parameters

rule OfficeIMO.Excel.ExcelConditionalFormattingInfo required
public void UpdateDataValidationMessages(string a1Range, Action<ExcelDataValidationMessageOptions> update) #

Updates each matching rule independently, preserving fields that the callback does not change.

Parameters

a1Range string required
A1 range overlapping the rules to update.
update System.Action<OfficeIMO.Excel.ExcelDataValidationMessageOptions> required
Synchronous mutation of each rule's current message settings.
public ExcelPivotSourceUpdateResult UpdatePivotTableSource(string pivotTableName, ExcelSheet sourceSheet, string sourceRange, ExcelPivotSourceUpdateOptions? options = null) #

Changes the worksheet source of an existing pivot table and requests an application refresh on open.

Parameters

pivotTableName string required
Pivot table name on this worksheet.
sourceSheet OfficeIMO.Excel.ExcelSheet required
Worksheet that contains the new source data.
sourceRange string required
New A1 source range including its header row.
options OfficeIMO.Excel.ExcelPivotSourceUpdateOptions? = null optional
Optional header and shared-cache safety settings.

Returns

ExcelPivotSourceUpdateResult Details about the updated cache and affected pivot tables.
public ExcelThreadedCommentResult UpdateThreadedComment(ExcelThreadedCommentUpdateOptions options) #

Updates the text, author, timestamp, or resolved state of an existing threaded comment.

Parameters

options OfficeIMO.Excel.ExcelThreadedCommentUpdateOptions required
public ExcelChartDataRange WriteChartData(ExcelChartData data, int startRow = 1, int startColumn = 1, string? categoryHeader = null, bool includeHeaderRow = true, bool numericCategories = false, ExcelChartDataOrientation orientation = Vertical) #

Writes chart data into the worksheet and returns the corresponding data range.

Parameters

data OfficeIMO.Excel.ExcelChartData required
startRow int = 1 optional
startColumn int = 1 optional
categoryHeader string? = null optional
includeHeaderRow bool = true optional
numericCategories bool = false optional
orientation OfficeIMO.Excel.ExcelChartDataOrientation = Vertical optional
public void WriteData(DataTable data, int row = 1, int column = 1, bool includeHeaders = true, ExcelExecutionMode? mode = null, CancellationToken cancellationToken = default) #

Writes typed cells from a DataTable without creating a native table or applying table layout defaults.

Parameters

data System.Data.DataTable required
row int = 1 optional
column int = 1 optional
includeHeaders bool = true optional
mode OfficeIMO.Excel.ExcelExecutionMode? = null optional
cancellationToken System.Threading.CancellationToken = default optional
WriteData``1 3 overloads
public void WriteData<T>(IEnumerable<T?> data, bool includeHeaders = true, int row = 1) #

Writes flattened object graphs as plain cells. Null and DBNull remain blank; empty strings remain text.

Type Parameters

T

Parameters

data System.Collections.Generic.IEnumerable<T?> required
includeHeaders bool = true optional
row int = 1 optional
public void WriteData<T>(IEnumerable<T?> data, params ValueTuple<string, Func<T?, object?>>[] columns) #

Writes plain cells through explicit selectors without runtime reflection or table creation.

Type Parameters

T

Parameters

data System.Collections.Generic.IEnumerable<T?> required
columns System.ValueTuple<string, System.Func<T?, object?>>[] required
public void WriteData<T>(IEnumerable<T?> data, bool includeHeaders, int row, params ValueTuple<string, Func<T?, object?>>[] columns) #

Writes plain cells at a chosen row through explicit selectors, preserving duplicate or blank display headers.

Type Parameters

T

Parameters

data System.Collections.Generic.IEnumerable<T?> required
includeHeaders bool required
row int required
columns System.ValueTuple<string, System.Func<T?, object?>>[] required

Properties

public IEnumerable<ExcelChart> Charts { get; } #

Enumerates charts on the worksheet.

public string Name { get; set; } #

Gets or sets the worksheet name.

public ExcelExecutionPolicy? ExecutionOverride { get; set; } #

Override execution policy for this sheet. Null = inherit from document.

public IEnumerable<ExcelImage> Images { get; } #

Enumerates worksheet images anchored in the drawing layer.

public IEnumerable<ExcelModernChart> ModernCharts { get; } #

Enumerates native and imported ChartEx drawings on this worksheet.

public ExcelDocument Document { get; } #

Gets the workbook that owns this worksheet.

public ExcelSheetPageSetup PageSetup { get; } #

Paper, orientation, scaling, margins, print area and titles, print options, headers and footers.

public ExcelSheetView View { get; } #

Frozen panes, gridlines, zero values, headings, direction, zoom and view mode.

public bool IsProtected { get; } #

Gets whether the worksheet is protected.

public ExcelRange UsedRange { get; } #

Gets the range from the first to the last used cell, including unsaved edits. An empty worksheet returns A1:A1, as Excel does, so the result is never null.

public ExcelColumnWidth? DefaultRowHeight { get; } #

Gets the worksheet default row height as a physical dimension, or null when the sheet uses the application default.

public bool DefaultRowsHidden { get; } #

Gets whether empty worksheet rows are hidden by default.

public ExcelColumnWidth? DefaultColumnWidth { get; } #

Gets the worksheet default column width in character units, or null when the sheet uses the application default.

public bool Hidden { get; } #

Gets whether the worksheet is hidden or very hidden in the workbook.

public bool VeryHidden { get; } #

Gets whether the worksheet is very hidden in the workbook.

Fields

public const int MaximumDataValidationFormulaLength #

Maximum character count supported by an Excel data-validation formula.

Value: 255

Extension Methods

public static ExcelChart AddContributionChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "Contribution", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a doughnut chart with category/percent labels for contribution and mix analysis.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "Contribution" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart
public static ExcelDashboardResult AddDashboard(ExcelSheet sheet, DataTable data, ExcelDashboardOptions? options = null) #

Builds a dashboard table and optional chart from a data table.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
Worksheet that receives the dashboard.
data System.Data.DataTable required
Tabular data to write.
options OfficeIMO.Excel.Reports.ExcelDashboardOptions? = null optional
Dashboard layout and styling options.

Returns

ExcelDashboardResult Dashboard table range and generated chart metadata.
public static ExcelChart AddDashboardChart(ExcelSheet sheet, ExcelDashboardChartOptions options) #

Adds a dashboard-ready chart from a range or table and applies preset styling.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
Worksheet that receives the chart.
options OfficeIMO.Excel.Reports.ExcelDashboardChartOptions required
Dashboard chart options.

Returns

ExcelChart The created chart.
public static ExcelChart AddKpiScorecardChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "KPI Scorecard", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a compact column chart with value callouts and dashboard-friendly defaults for KPI scorecards.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "KPI Scorecard" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart
public static ExcelChart AddRevenueTrendChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "Revenue Trend", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a line chart with dashboard-friendly defaults for time-series revenue or volume trends.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "Revenue Trend" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart
public static ExcelChart AddStatusBreakdownChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "Status Breakdown", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a doughnut chart with dashboard-friendly defaults for status, category, or allocation breakdowns.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "Status Breakdown" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart
public static ExcelSubtotalResult AddSubtotalSummary(ExcelSheet sheet, ExcelSubtotalOptions options) #

Creates a grouped subtotal summary block from a contiguous worksheet data range.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
Worksheet that holds the data.
options OfficeIMO.Excel.Reports.ExcelSubtotalOptions required
Subtotal generation options.

Returns

ExcelSubtotalResult Information about the generated summary block.
public static ExcelChart AddTopNBarChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "Top Items", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a horizontal bar chart with dashboard-friendly defaults for top-N rankings.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "Top Items" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart
public static ExcelChart AddVarianceColumnChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "Variance", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a clustered column chart with dashboard-friendly defaults for variance comparisons.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "Variance" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart
public static ExcelChart AddVarianceWaterfallChart(ExcelSheet sheet, string dataRangeA1, int row, int column, string title = "Variance Bridge", OfficeLength? width = null, OfficeLength? height = null, bool hasHeaders = true, bool includeCachedData = true) #

Adds a waterfall-style stacked column chart for variance bridges prepared with helper series.

Parameters

sheet OfficeIMO.Excel.ExcelSheet required
dataRangeA1 string required
row int required
column int required
title string = "Variance Bridge" optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
hasHeaders bool = true optional
includeCachedData bool = true optional

Returns

ExcelChart