API Reference

Class

ExcelSheet

Namespace OfficeIMO.Excel
Assembly OfficeIMO.Excel
Implements
IDisposable

Helpers for worksheet cell comments (notes).

Inheritance

  • Object
  • ExcelSheet

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters

Constructors

ExcelSheet 2 overloads
public ExcelSheet(ExcelDocument excelDocument, SpreadsheetDocument spreadSheetDocument, Sheet sheet) #

Initializes a worksheet from an existing Sheet element.

Parameters

excelDocument OfficeIMO.Excel.ExcelDocument requiredposition: 0
Parent document.
spreadSheetDocument DocumentFormat.OpenXml.Packaging.SpreadsheetDocument requiredposition: 1
Open XML spreadsheet document.
sheet DocumentFormat.OpenXml.Spreadsheet.Sheet requiredposition: 2
Underlying sheet element.
public ExcelSheet(ExcelDocument excelDocument, WorkbookPart workbookpart, SpreadsheetDocument spreadSheetDocument, String name) #

Creates a new worksheet and appends it to the workbook.

Parameters

excelDocument OfficeIMO.Excel.ExcelDocument requiredposition: 0
Parent document.
workbookpart DocumentFormat.OpenXml.Packaging.WorkbookPart requiredposition: 1
Workbook part to add the worksheet to.
spreadSheetDocument DocumentFormat.OpenXml.Packaging.SpreadsheetDocument requiredposition: 2
Open XML spreadsheet document.
name System.String requiredposition: 3
Worksheet name.

Methods

public Void AddAutoFilter(String range, Dictionary<UInt32, IEnumerable<String>> filterCriteria = null) #
Returns: Void

Adds an AutoFilter to the worksheet or table.

Parameters

range System.String requiredposition: 0
The cell range to apply the filter to.
filterCriteria System.Collections.Generic.Dictionary{System.UInt32,System.Collections.Generic.IEnumerable{System.String}} = null optionalposition: 1
Optional filter criteria to apply.
public ExcelChart AddBubbleChartFromRanges(IEnumerable<ExcelChartSeriesRange> seriesRanges, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, String title = null) #
Returns: ExcelChart

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

Parameters

seriesRanges System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelChartSeriesRange} requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
widthPixels System.Int32 = 640 optionalposition: 3
heightPixels System.Int32 = 360 optionalposition: 4
title System.String = null optionalposition: 5
AddChart 2 overloads
public ExcelChart AddChart(ExcelChartData data, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, String title = null) #
Returns: ExcelChart

Adds a chart to the worksheet using the provided data. Data is stored on a hidden chart data sheet.

Parameters

data OfficeIMO.Excel.ExcelChartData requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
widthPixels System.Int32 = 640 optionalposition: 3
heightPixels System.Int32 = 360 optionalposition: 4
type OfficeIMO.Excel.ExcelChartType = ColumnClustered optionalposition: 5
title System.String = null optionalposition: 6
public ExcelChart AddChart(ExcelChartDataRange dataRange, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, ExcelChartData cachedData = null, String title = null) #
Returns: ExcelChart

Adds a chart to the worksheet using an existing data range.

Parameters

dataRange OfficeIMO.Excel.ExcelChartDataRange requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
widthPixels System.Int32 = 640 optionalposition: 3
heightPixels System.Int32 = 360 optionalposition: 4
type OfficeIMO.Excel.ExcelChartType = ColumnClustered optionalposition: 5
cachedData OfficeIMO.Excel.ExcelChartData = null optionalposition: 6
title System.String = null optionalposition: 7
public ExcelChart AddChartFromRange(String dataRangeA1, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, Boolean hasHeaders = true, String title = null, Boolean includeCachedData = true) #
Returns: ExcelChart

Adds a chart using an A1 range on this sheet.

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
widthPixels System.Int32 = 640 optionalposition: 3
heightPixels System.Int32 = 360 optionalposition: 4
type OfficeIMO.Excel.ExcelChartType = ColumnClustered optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
title System.String = null optionalposition: 7
includeCachedData System.Boolean = true optionalposition: 8
public ExcelChart AddChartFromTable(String tableName, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, String title = null, Boolean includeCachedData = true) #
Returns: ExcelChart

Adds a chart from a table name on this sheet.

Parameters

tableName System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
widthPixels System.Int32 = 640 optionalposition: 3
heightPixels System.Int32 = 360 optionalposition: 4
type OfficeIMO.Excel.ExcelChartType = ColumnClustered optionalposition: 5
title System.String = null optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
AddConditionalColorScale 2 overloads
public Void AddConditionalColorScale(String range, OfficeColor startColor, OfficeColor endColor) #
Returns: Void

Adds a two-color scale conditional format to a range.

Parameters

range System.String requiredposition: 0
A1-style range to format.
startColor OfficeIMO.Drawing.OfficeColor requiredposition: 1
Starting color of the scale.
endColor OfficeIMO.Drawing.OfficeColor requiredposition: 2
Ending color of the scale.
public Void AddConditionalColorScale(String range, String startColor, String endColor) #
Returns: Void

Adds a two-color scale conditional format to a range using hex colors.

Parameters

range System.String requiredposition: 0
A1-style range to format.
startColor System.String requiredposition: 1
Starting color in hex (e.g. FF0000).
endColor System.String requiredposition: 2
Ending color in hex.
AddConditionalDataBar 2 overloads
public Void AddConditionalDataBar(String range, OfficeColor color) #
Returns: Void

Adds a data bar conditional format to a range.

Parameters

range System.String requiredposition: 0
A1-style range to format.
color OfficeIMO.Drawing.OfficeColor requiredposition: 1
Bar color.
public Void AddConditionalDataBar(String range, String color) #
Returns: Void

Adds a data bar conditional format to a range using a hex color.

Parameters

range System.String requiredposition: 0
A1-style range to format.
color System.String requiredposition: 1
Bar color in hex (e.g. FF0000).
public Void AddConditionalDuplicateValuesRule(String range) #
Returns: Void

Adds a duplicate-values conditional formatting rule.

Parameters

range System.String requiredposition: 0
public Void AddConditionalFormulaRule(String range, String formula, Boolean stopIfTrue = false) #
Returns: Void

Adds a formula-based conditional formatting rule.

Parameters

range System.String requiredposition: 0
formula System.String requiredposition: 1
stopIfTrue System.Boolean = false optionalposition: 2
AddConditionalIconSet 3 overloads
public Void AddConditionalIconSet(String range, IconSetValues iconSet, Boolean showValue, Boolean reverseIconOrder) #
Returns: Void

Adds an icon set conditional format to a range.

Parameters

range System.String requiredposition: 0
A1-style range to format.
iconSet DocumentFormat.OpenXml.Spreadsheet.IconSetValues requiredposition: 1
Icon set type (e.g., ThreeTrafficLights1, ThreeSymbols, FourArrows, FiveRatings).
showValue System.Boolean requiredposition: 2
Whether to display the underlying cell values.
reverseIconOrder System.Boolean requiredposition: 3
Reverse icon order.
public Void AddConditionalIconSet(String range, IconSetValues iconSet, Boolean showValue, Boolean reverseIconOrder, Double[] percentThresholds, Double[] numberThresholds) #
Returns: Void

Adds an icon set conditional format to a range with optional explicit thresholds. Provide either percentThresholds (0..100) or numberThresholds as absolute values. The number of thresholds must match the icon count for the selected icon set (3/4/5).

Parameters

range System.String requiredposition: 0
iconSet DocumentFormat.OpenXml.Spreadsheet.IconSetValues requiredposition: 1
showValue System.Boolean requiredposition: 2
reverseIconOrder System.Boolean requiredposition: 3
percentThresholds System.Double[] requiredposition: 4
numberThresholds System.Double[] requiredposition: 5
public Void AddConditionalIconSet(String range) #
Returns: Void

Overload with common defaults for convenience.

Parameters

range System.String requiredposition: 0
public Void AddConditionalRule(String range, ConditionalFormattingOperatorValues operator, String formula1, String formula2 = null) #
Returns: Void

Adds a conditional formatting rule to the specified range.

Parameters

range System.String requiredposition: 0
A1-style range to apply the rule to.
operator DocumentFormat.OpenXml.Spreadsheet.ConditionalFormattingOperatorValues requiredposition: 1
Comparison operator for the rule.
formula1 System.String requiredposition: 2
Primary formula or value.
formula2 System.String = null optionalposition: 3
Optional secondary formula or value.
public Void AddConditionalTopBottomRule(String range, UInt32 rank, Boolean bottom = false, Boolean percent = false) #
Returns: Void

Adds a top/bottom conditional formatting rule.

Parameters

range System.String requiredposition: 0
rank System.UInt32 requiredposition: 1
bottom System.Boolean = false optionalposition: 2
percent System.Boolean = false optionalposition: 3
public ExcelChart AddContributionChart(String dataRangeA1, Int32 row, Int32 column, String title = "Contribution", Int32 widthPixels = 520, Int32 heightPixels = 320, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "Contribution" optionalposition: 3
widthPixels System.Int32 = 520 optionalposition: 4
heightPixels System.Int32 = 320 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
public ExcelImage AddImage(Int32 row, Int32 column, Byte[] imageBytes, String contentType = "image/png", Int32 widthPixels = 96, Int32 heightPixels = 32, Int32 offsetXPixels = 0, Int32 offsetYPixels = 0, String name = null, String altText = null, Boolean lockAspectRatio = true) #
Returns: ExcelImage

Adds an image anchored to the specified cell and returns a wrapper for setting metadata and sizing.

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
imageBytes System.Byte[] requiredposition: 2
Image bytes.
contentType System.String = "image/png" optionalposition: 3
Content type, e.g. image/png or image/jpeg.
widthPixels System.Int32 = 96 optionalposition: 4
Width in pixels.
heightPixels System.Int32 = 32 optionalposition: 5
Height in pixels.
offsetXPixels System.Int32 = 0 optionalposition: 6
Optional X offset from cell origin in pixels.
offsetYPixels System.Int32 = 0 optionalposition: 7
Optional Y offset from cell origin in pixels.
name System.String = null optionalposition: 8
Optional drawing name.
altText System.String = null optionalposition: 9
Optional alternative text description.
lockAspectRatio System.Boolean = true optionalposition: 10
Whether Excel should keep the picture aspect ratio locked.
public Void AddImageAt(Int32 row, Int32 column, Byte[] imageBytes, String contentType = "image/png", Int32 widthPixels = 96, Int32 heightPixels = 32, Int32 offsetXPixels = 0, Int32 offsetYPixels = 0) #
Returns: Void

Adds an image anchored to the specified cell. The top-left of the image will align to the cell's top-left, with optional pixel offsets. Size is specified in pixels and converted to EMUs.

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
imageBytes System.Byte[] requiredposition: 2
Image bytes.
contentType System.String = "image/png" optionalposition: 3
Content type, e.g. image/png or image/jpeg.
widthPixels System.Int32 = 96 optionalposition: 4
Width in pixels.
heightPixels System.Int32 = 32 optionalposition: 5
Height in pixels.
offsetXPixels System.Int32 = 0 optionalposition: 6
Optional X offset from cell origin in pixels.
offsetYPixels System.Int32 = 0 optionalposition: 7
Optional Y offset from cell origin in pixels.
public ExcelImage AddImageFromUrl(Int32 row, Int32 column, String url, Int32 widthPixels = 96, Int32 heightPixels = 32, Int32 offsetXPixels = 0, Int32 offsetYPixels = 0, String name = null, String altText = null, Boolean lockAspectRatio = true) #
Returns: ExcelImage

Downloads an image from URL and returns a wrapper for setting metadata and sizing. Returns null when the image cannot be fetched.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
url System.String requiredposition: 2
widthPixels System.Int32 = 96 optionalposition: 3
heightPixels System.Int32 = 32 optionalposition: 4
offsetXPixels System.Int32 = 0 optionalposition: 5
offsetYPixels System.Int32 = 0 optionalposition: 6
name System.String = null optionalposition: 7
altText System.String = null optionalposition: 8
lockAspectRatio System.Boolean = true optionalposition: 9
public Void AddImageFromUrlAt(Int32 row, Int32 column, String url, Int32 widthPixels = 96, Int32 heightPixels = 32, Int32 offsetXPixels = 0, Int32 offsetYPixels = 0) #
Returns: Void

Downloads an image from URL (with timeout and size limits) and anchors it to the specified cell.

Parameters

row System.Int32 requiredposition: 0
1-based row index where the top edge of the image will be anchored.
column System.Int32 requiredposition: 1
1-based column index where the left edge of the image will be anchored.
url System.String requiredposition: 2
Remote image URL to download. Requests timeout after 5 seconds and must be smaller than 2 MB.
widthPixels System.Int32 = 96 optionalposition: 3
Desired image width in pixels. Defaults to 96 px, converted to English Metric Units (EMUs) for OpenXML positioning.
heightPixels System.Int32 = 32 optionalposition: 4
Desired image height in pixels. Defaults to 32 px, converted to EMUs.
offsetXPixels System.Int32 = 0 optionalposition: 5
Optional horizontal offset in pixels from the cell's left boundary. Positive values move the image right; defaults to 0 px.
offsetYPixels System.Int32 = 0 optionalposition: 6
Optional vertical offset in pixels from the cell's top boundary. Positive values move the image down; defaults to 0 px.
public ExcelChart AddKpiScorecardChart(String dataRangeA1, Int32 row, Int32 column, String title = "KPI Scorecard", Int32 widthPixels = 520, Int32 heightPixels = 300, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "KPI Scorecard" optionalposition: 3
widthPixels System.Int32 = 520 optionalposition: 4
heightPixels System.Int32 = 300 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
public Void AddManualColumnPageBreak(Int32 column, Boolean save = true) #
Returns: Void

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

Parameters

column System.Int32 requiredposition: 0
save System.Boolean = true optionalposition: 1
public Void AddManualRowPageBreak(Int32 row, Boolean save = true) #
Returns: Void

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

Parameters

row System.Int32 requiredposition: 0
save System.Boolean = true optionalposition: 1
public ExcelChart AddPivotChartFromRange(String pivotTableName, String dataRangeA1, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, Boolean hasHeaders = true, String title = null, Boolean includeCachedData = true, UInt32 formatId = 0) #
Returns: ExcelChart

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

Parameters

pivotTableName System.String requiredposition: 0
dataRangeA1 System.String requiredposition: 1
row System.Int32 requiredposition: 2
column System.Int32 requiredposition: 3
widthPixels System.Int32 = 640 optionalposition: 4
heightPixels System.Int32 = 360 optionalposition: 5
type OfficeIMO.Excel.ExcelChartType = ColumnClustered optionalposition: 6
hasHeaders System.Boolean = true optionalposition: 7
title System.String = null optionalposition: 8
includeCachedData System.Boolean = true optionalposition: 9
formatId System.UInt32 = 0 optionalposition: 10
AddPivotTable 2 overloads
public Void AddPivotTable(String sourceRange, String destinationCell, String name, IEnumerable<String> rowFields, IEnumerable<String> columnFields, IEnumerable<String> pageFields, IEnumerable<ExcelPivotDataField> dataFields, Boolean showRowGrandTotals, Boolean showColumnGrandTotals, String pivotStyleName, ExcelPivotLayout layout, Nullable<Boolean> dataOnRows, Nullable<Boolean> showHeaders, Nullable<Boolean> showEmptyRows, Nullable<Boolean> showEmptyColumns, Nullable<Boolean> showDrill) #
Returns: Void

Adds a basic pivot table based on a source range and places it at a destination cell.

Parameters

sourceRange System.String requiredposition: 0
Source data range (including header row), e.g. "A1:D100".
destinationCell System.String requiredposition: 1
Top-left cell for the pivot table (e.g. "F2").
name System.String requiredposition: 2
Optional pivot table name. Defaults to "PivotTable1" style.
rowFields System.Collections.Generic.IEnumerable{System.String} requiredposition: 3
Optional row fields (header names).
columnFields System.Collections.Generic.IEnumerable{System.String} requiredposition: 4
Optional column fields (header names).
pageFields System.Collections.Generic.IEnumerable{System.String} requiredposition: 5
Optional page fields (header names) used as filters.
dataFields System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotDataField} requiredposition: 6
Optional data field definitions. Defaults to last column with Sum.
showRowGrandTotals System.Boolean requiredposition: 7
Show row grand totals.
showColumnGrandTotals System.Boolean requiredposition: 8
Show column grand totals.
pivotStyleName System.String requiredposition: 9
Optional pivot table style name.
layout OfficeIMO.Excel.ExcelPivotLayout requiredposition: 10
Layout mode (Compact, Outline, Tabular).
dataOnRows System.Nullable{System.Boolean} requiredposition: 11
Whether to show data fields on rows instead of columns.
showHeaders System.Nullable{System.Boolean} requiredposition: 12
Whether to show field headers.
showEmptyRows System.Nullable{System.Boolean} requiredposition: 13
Whether to show empty rows.
showEmptyColumns System.Nullable{System.Boolean} requiredposition: 14
Whether to show empty columns.
showDrill System.Nullable{System.Boolean} requiredposition: 15
Whether to show drill indicators.
public Void AddPivotTable(String sourceRange, String destinationCell, String name = null, IEnumerable<String> rowFields = null, IEnumerable<String> columnFields = null, IEnumerable<String> pageFields = null, IEnumerable<ExcelPivotDataField> dataFields = null, Boolean showRowGrandTotals = true, Boolean showColumnGrandTotals = true, String pivotStyleName = null, ExcelPivotLayout layout = Compact, Nullable<Boolean> dataOnRows = null, Nullable<Boolean> showHeaders = null, Nullable<Boolean> showEmptyRows = null, Nullable<Boolean> showEmptyColumns = null, Nullable<Boolean> showDrill = null, IEnumerable<ExcelPivotFieldOptions> fieldOptions = null, String rowHeaderCaption = null, String columnHeaderCaption = null, String grandTotalCaption = null, String missingCaption = null, String errorCaption = null, Nullable<Boolean> showDataDropDown = null, Nullable<Boolean> showDropZones = null, Nullable<Boolean> showDataTips = null, Nullable<Boolean> showMemberPropertyTips = null, Nullable<Boolean> fieldListSortAscending = null, Nullable<Boolean> customListSort = null, IEnumerable<ExcelPivotFilter> pivotFilters = null, IEnumerable<ExcelPivotCalculatedField> calculatedFields = null, IEnumerable<ExcelPivotGrouping> groupings = null) #
Returns: Void

Adds a basic pivot table based on a source range and places it at a destination cell.

Parameters

sourceRange System.String requiredposition: 0
Source data range (including header row), e.g. "A1:D100".
destinationCell System.String requiredposition: 1
Top-left cell for the pivot table (e.g. "F2").
name System.String = null optionalposition: 2
Optional pivot table name. Defaults to "PivotTable1" style.
rowFields System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 3
Optional row fields (header names).
columnFields System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 4
Optional column fields (header names).
pageFields System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 5
Optional page fields (header names) used as filters.
dataFields System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotDataField} = null optionalposition: 6
Optional data field definitions. Defaults to last column with Sum.
showRowGrandTotals System.Boolean = true optionalposition: 7
Show row grand totals.
showColumnGrandTotals System.Boolean = true optionalposition: 8
Show column grand totals.
pivotStyleName System.String = null optionalposition: 9
Optional pivot table style name.
layout OfficeIMO.Excel.ExcelPivotLayout = Compact optionalposition: 10
Layout mode (Compact, Outline, Tabular).
dataOnRows System.Nullable{System.Boolean} = null optionalposition: 11
Whether to show data fields on rows instead of columns.
showHeaders System.Nullable{System.Boolean} = null optionalposition: 12
Whether to show field headers.
showEmptyRows System.Nullable{System.Boolean} = null optionalposition: 13
Whether to show empty rows.
showEmptyColumns System.Nullable{System.Boolean} = null optionalposition: 14
Whether to show empty columns.
showDrill System.Nullable{System.Boolean} = null optionalposition: 15
Whether to show drill indicators.
fieldOptions System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotFieldOptions} = null optionalposition: 16
Optional formatting and display options for source fields.
rowHeaderCaption System.String = null optionalposition: 17
Optional row header caption.
columnHeaderCaption System.String = null optionalposition: 18
Optional column header caption.
grandTotalCaption System.String = null optionalposition: 19
Optional grand total caption.
missingCaption System.String = null optionalposition: 20
Optional caption for missing values.
errorCaption System.String = null optionalposition: 21
Optional caption for error values.
showDataDropDown System.Nullable{System.Boolean} = null optionalposition: 22
Whether to show the data drop-down.
showDropZones System.Nullable{System.Boolean} = null optionalposition: 23
Whether to show drop zones.
showDataTips System.Nullable{System.Boolean} = null optionalposition: 24
Whether to show data tips.
showMemberPropertyTips System.Nullable{System.Boolean} = null optionalposition: 25
Whether to show member property tips.
fieldListSortAscending System.Nullable{System.Boolean} = null optionalposition: 26
Whether field list sorting is ascending.
customListSort System.Nullable{System.Boolean} = null optionalposition: 27
Whether custom-list sorting is enabled.
pivotFilters System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotFilter} = null optionalposition: 28
Optional label and value filters.
calculatedFields System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotCalculatedField} = null optionalposition: 29
Optional formula-backed pivot cache fields.
groupings System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotGrouping} = null optionalposition: 30
Optional date or numeric grouping metadata.
public ExcelChart AddRevenueTrendChart(String dataRangeA1, Int32 row, Int32 column, String title = "Revenue Trend", Int32 widthPixels = 720, Int32 heightPixels = 320, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "Revenue Trend" optionalposition: 3
widthPixels System.Int32 = 720 optionalposition: 4
heightPixels System.Int32 = 320 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
public ExcelChart AddScatterChartFromRanges(IEnumerable<ExcelChartSeriesRange> seriesRanges, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, String title = null) #
Returns: ExcelChart

Adds a scatter chart using explicit X/Y ranges.

Parameters

seriesRanges System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelChartSeriesRange} requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
widthPixels System.Int32 = 640 optionalposition: 3
heightPixels System.Int32 = 360 optionalposition: 4
title System.String = null optionalposition: 5
AddSparklines 2 overloads
public Void AddSparklines(String dataRange, String locationRange, SparklineTypeValues type, Boolean displayMarkers = false, Boolean displayHighLow = false, Boolean displayFirstLast = false, Boolean displayNegative = false, Boolean displayAxis = false, String seriesColor = null, String axisColor = null, String negativeColor = null, String markersColor = null, String highColor = null, String lowColor = null, String firstColor = null, String lastColor = null) #
Returns: Void

Adds sparklines to the worksheet.

Parameters

dataRange System.String requiredposition: 0
A1 range containing the data (e.g., "B2:M2").
locationRange System.String requiredposition: 1
A1 range where sparklines will be placed (e.g., "N2:N2").
type DocumentFormat.OpenXml.Office2010.Excel.SparklineTypeValues requiredposition: 2
Sparkline type.
displayMarkers System.Boolean = false optionalposition: 3
Show markers for each data point.
displayHighLow System.Boolean = false optionalposition: 4
Show high/low markers.
displayFirstLast System.Boolean = false optionalposition: 5
Show first/last markers.
displayNegative System.Boolean = false optionalposition: 6
Show negative markers.
displayAxis System.Boolean = false optionalposition: 7
Show axis.
seriesColor System.String = null optionalposition: 8
Sparkline series color (#RRGGBB or #AARRGGBB).
axisColor System.String = null optionalposition: 9
Axis color (#RRGGBB or #AARRGGBB).
negativeColor System.String = null optionalposition: 10
Negative point color (#RRGGBB or #AARRGGBB).
markersColor System.String = null optionalposition: 11
Markers color (#RRGGBB or #AARRGGBB).
highColor System.String = null optionalposition: 12
High point color (#RRGGBB or #AARRGGBB).
lowColor System.String = null optionalposition: 13
Low point color (#RRGGBB or #AARRGGBB).
firstColor System.String = null optionalposition: 14
First point color (#RRGGBB or #AARRGGBB).
lastColor System.String = null optionalposition: 15
Last point color (#RRGGBB or #AARRGGBB).
public Void AddSparklines(String dataRange, String locationRange, Boolean displayMarkers = false, Boolean displayHighLow = false, Boolean displayFirstLast = false, Boolean displayNegative = false, Boolean displayAxis = false, String seriesColor = null, String axisColor = null, String negativeColor = null, String markersColor = null, String highColor = null, String lowColor = null, String firstColor = null, String lastColor = null) #
Returns: Void

Adds line sparklines to the worksheet.

Parameters

dataRange System.String requiredposition: 0
A1 range containing the data (e.g., "B2:M2").
locationRange System.String requiredposition: 1
A1 range where sparklines will be placed (e.g., "N2:N2").
displayMarkers System.Boolean = false optionalposition: 2
Show markers for each data point.
displayHighLow System.Boolean = false optionalposition: 3
Show high/low markers.
displayFirstLast System.Boolean = false optionalposition: 4
Show first/last markers.
displayNegative System.Boolean = false optionalposition: 5
Show negative markers.
displayAxis System.Boolean = false optionalposition: 6
Show axis.
seriesColor System.String = null optionalposition: 7
Sparkline series color (#RRGGBB or #AARRGGBB).
axisColor System.String = null optionalposition: 8
Axis color (#RRGGBB or #AARRGGBB).
negativeColor System.String = null optionalposition: 9
Negative point color (#RRGGBB or #AARRGGBB).
markersColor System.String = null optionalposition: 10
Markers color (#RRGGBB or #AARRGGBB).
highColor System.String = null optionalposition: 11
High point color (#RRGGBB or #AARRGGBB).
lowColor System.String = null optionalposition: 12
Low point color (#RRGGBB or #AARRGGBB).
firstColor System.String = null optionalposition: 13
First point color (#RRGGBB or #AARRGGBB).
lastColor System.String = null optionalposition: 14
Last point color (#RRGGBB or #AARRGGBB).
public ExcelChart AddStatusBreakdownChart(String dataRangeA1, Int32 row, Int32 column, String title = "Status Breakdown", Int32 widthPixels = 520, Int32 heightPixels = 320, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "Status Breakdown" optionalposition: 3
widthPixels System.Int32 = 520 optionalposition: 4
heightPixels System.Int32 = 320 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
AddTable 2 overloads
public Void AddTable(String range, Boolean hasHeader, String name, TableStyle style) #
Returns: Void

Adds an Excel table to the worksheet over the specified range.

Parameters

range System.String requiredposition: 0
Cell range (e.g. "A1:B3") defining the table area.
hasHeader System.Boolean requiredposition: 1
Indicates whether the first row is a header row.
name System.String requiredposition: 2
Name of the table. If empty, a default name is used.
style OfficeIMO.Excel.TableStyle requiredposition: 3
Table style to apply.

Exceptions

  • ArgumentNullException โ€“ Thrown when range is null or empty.
  • ArgumentException โ€“ Thrown when range is not in a valid format.
  • InvalidOperationException โ€“ Thrown when the specified range overlaps with an existing table.
public Void AddTable(String range, Boolean hasHeader, String name, TableStyle style, Boolean includeAutoFilter, TableNameValidationMode validationMode = Sanitize) #
Returns: Void

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

Parameters

range System.String requiredposition: 0
Cell range (e.g. "A1:B3") defining the table area.
hasHeader System.Boolean requiredposition: 1
Indicates whether the first row is a header row.
name System.String requiredposition: 2
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.TableStyle requiredposition: 3
Table style to apply.
includeAutoFilter System.Boolean requiredposition: 4
Whether to include AutoFilter dropdowns in the table headers.
validationMode OfficeIMO.Excel.TableNameValidationMode = Sanitize optionalposition: 5
Controls how invalid table names are handled: Sanitize (default) replaces invalid characters and adjusts the name; Strict throws descriptive exceptions for invalid names.
public ExcelChart AddTopNBarChart(String dataRangeA1, Int32 row, Int32 column, String title = "Top Items", Int32 widthPixels = 640, Int32 heightPixels = 360, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "Top Items" optionalposition: 3
widthPixels System.Int32 = 640 optionalposition: 4
heightPixels System.Int32 = 360 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
public ExcelChart AddVarianceColumnChart(String dataRangeA1, Int32 row, Int32 column, String title = "Variance", Int32 widthPixels = 640, Int32 heightPixels = 360, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "Variance" optionalposition: 3
widthPixels System.Int32 = 640 optionalposition: 4
heightPixels System.Int32 = 360 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
public ExcelChart AddVarianceWaterfallChart(String dataRangeA1, Int32 row, Int32 column, String title = "Variance Bridge", Int32 widthPixels = 720, Int32 heightPixels = 360, Boolean hasHeaders = true, Boolean includeCachedData = true) #
Returns: ExcelChart

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

Parameters

dataRangeA1 System.String requiredposition: 0
row System.Int32 requiredposition: 1
column System.Int32 requiredposition: 2
title System.String = "Variance Bridge" optionalposition: 3
widthPixels System.Int32 = 720 optionalposition: 4
heightPixels System.Int32 = 360 optionalposition: 5
hasHeaders System.Boolean = true optionalposition: 6
includeCachedData System.Boolean = true optionalposition: 7
public String AppendDataTableToTable(DataTable dataTable, String tableName, Boolean matchColumnsByHeader = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

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

Parameters

dataTable System.Data.DataTable requiredposition: 0
Source DataTable containing rows to append.
tableName System.String requiredposition: 1
Existing table name or display name.
matchColumnsByHeader System.Boolean = true optionalposition: 2
When true, DataTable columns are matched to table columns by header text. When false, columns are appended by position.
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
Optional execution mode override.
ct System.Threading.CancellationToken = null optionalposition: 4
Cancellation token.

Returns

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.
ApplyTemplate 4 overloads
public Int32 ApplyTemplate(IDictionary<String, Object> values, IFormatProvider provider = null, Boolean throwOnMissing = false) #
Returns: Int32

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

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
provider System.IFormatProvider = null optionalposition: 1
throwOnMissing System.Boolean = false optionalposition: 2
public Int32 ApplyTemplate(Object model, ExcelTemplateOptions options) #
Returns: Int32

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

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
options OfficeIMO.Excel.ExcelTemplateOptions requiredposition: 1
public Int32 ApplyTemplate(Object model, IFormatProvider provider = null, Boolean throwOnMissing = false) #
Returns: Int32

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 System.Object requiredposition: 0
provider System.IFormatProvider = null optionalposition: 1
throwOnMissing System.Boolean = false optionalposition: 2
ApplyTemplate(System.Object model, OfficeIMO.Excel.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 System.Object required
options OfficeIMO.Excel.ExcelTemplateOptions required
ApplyTemplateOptionalRows 2 overloads
public Int32 ApplyTemplateOptionalRows(Int32 firstRow, Int32 rowCount, Boolean include, Object model, ExcelTemplateOptions options = null) #
Returns: Int32

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 System.Int32 requiredposition: 0
1-based first row in the optional block.
rowCount System.Int32 requiredposition: 1
Number of rows in the optional block.
include System.Boolean requiredposition: 2
True to keep and bind the block; false to remove it.
values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 3
Values used when the block is included.
options OfficeIMO.Excel.ExcelTemplateOptions = null optionalposition: 4
Optional template binding options.
ApplyTemplateOptionalRows(System.Int32 firstRow, System.Int32 rowCount, System.Boolean include, System.Object model, OfficeIMO.Excel.ExcelTemplateOptions options) #

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 System.Int32 required
1-based first row in the optional block.
rowCount System.Int32 required
Number of rows in the optional block.
include System.Boolean required
True to keep and bind the block; false to remove it.
model System.Object required
Model used when the block is included.
options OfficeIMO.Excel.ExcelTemplateOptions required
Optional template binding options.
public Int32 ApplyTemplateRows<T>(Int32 templateRow, IEnumerable<T> rows, ExcelTemplateOptions options = null) #
Returns: Int32

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

Type Parameters

T

Parameters

templateRow System.Int32 requiredposition: 0
1-based row number containing template markers.
rows System.Collections.Generic.IEnumerable{System.Collections.Generic.IDictionary{System.String,System.Object}} requiredposition: 1
Row value dictionaries. Each dictionary is bound to one copied row.
options OfficeIMO.Excel.ExcelTemplateOptions = null optionalposition: 2
Optional template binding options.
ApplyTemplateRows``1(System.Int32 templateRow, System.Collections.Generic.IEnumerable{``0} rows, OfficeIMO.Excel.ExcelTemplateOptions options) #

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.

Parameters

templateRow System.Int32 required
1-based row number containing template markers.
rows System.Collections.Generic.IEnumerable{``0} required
Row models. Each model is bound to one copied row.
options OfficeIMO.Excel.ExcelTemplateOptions required
Optional template binding options.
public Void AutoFilterAdd(String a1Range) #
Returns: Void

Attaches an AutoFilter to the given A1 range (e.g., "A1:C200").

Parameters

a1Range System.String requiredposition: 0
public Void AutoFilterByHeaderBetween(String header, Double minimumInclusive, Double maximumInclusive) #
Returns: Void

Applies an AutoFilter numeric inclusive range filter to a column resolved by header within the current AutoFilter range.

Parameters

header System.String requiredposition: 0
minimumInclusive System.Double requiredposition: 1
maximumInclusive System.Double requiredposition: 2
public Void AutoFilterByHeaderContains(String header, String containsText) #
Returns: Void

Applies an AutoFilter text contains filter to a column resolved by header within the current AutoFilter range. Uses wildcard pattern matching ("*text*") via CustomFilters with Equal operator. When the header is missing the operation is skipped.

Parameters

header System.String requiredposition: 0
containsText System.String requiredposition: 1
public Void AutoFilterByHeaderDoesNotContain(String header, String containsText) #
Returns: Void

Applies an AutoFilter text does-not-contain filter to a column resolved by header within the current AutoFilter range. Uses wildcard pattern matching ("*text*") via CustomFilters with NotEqual operator.

Parameters

header System.String requiredposition: 0
containsText System.String requiredposition: 1
public Void AutoFilterByHeaderEndsWith(String header, String endsWithText) #
Returns: Void

Applies an AutoFilter text ends-with filter to a column resolved by header within the current AutoFilter range. Uses wildcard pattern matching ("*text") via CustomFilters with Equal operator.

Parameters

header System.String requiredposition: 0
endsWithText System.String requiredposition: 1
public Void AutoFilterByHeaderEquals(String header, IEnumerable<String> values) #
Returns: Void

Applies an AutoFilter equals filter to a column resolved by header within the current AutoFilter range. Ensures an AutoFilter exists over the sheet's UsedRange when none is present. When the header is missing the operation is skipped.

Parameters

header System.String requiredposition: 0
values System.Collections.Generic.IEnumerable{System.String} requiredposition: 1
public Void AutoFilterByHeaderGreaterThanOrEqual(String header, Double value) #
Returns: Void

Applies an AutoFilter numeric greater-than-or-equal filter to a column resolved by header within the current AutoFilter range.

Parameters

header System.String requiredposition: 0
value System.Double requiredposition: 1
public Void AutoFilterByHeaderLessThanOrEqual(String header, Double value) #
Returns: Void

Applies an AutoFilter numeric less-than-or-equal filter to a column resolved by header within the current AutoFilter range.

Parameters

header System.String requiredposition: 0
value System.Double requiredposition: 1
public Void AutoFilterByHeaderNotBetween(String header, Double minimumExclusive, Double maximumExclusive) #
Returns: Void

Applies an AutoFilter numeric outside-range filter to a column resolved by header within the current AutoFilter range. Values lower than minimumExclusive or higher than maximumExclusive remain visible.

Parameters

header System.String requiredposition: 0
minimumExclusive System.Double requiredposition: 1
maximumExclusive System.Double requiredposition: 2
public Void AutoFilterByHeaderNotEqual(String header, Double value) #
Returns: Void

Applies an AutoFilter numeric not-equal filter to a column resolved by header within the current AutoFilter range.

Parameters

header System.String requiredposition: 0
value System.Double requiredposition: 1
public Void AutoFilterByHeadersEquals(params ValueTuple<String, IEnumerable<String>>[] filters) #
Returns: Void

Applies equals filters for multiple headers at once (AND semantics across columns, OR semantics within a column). Headers that cannot be resolved are ignored.

Parameters

filters System.ValueTuple{System.String,System.Collections.Generic.IEnumerable{System.String}}[] requiredposition: 0
public Void AutoFilterByHeaderStartsWith(String header, String startsWithText) #
Returns: Void

Applies an AutoFilter text starts-with filter to a column resolved by header within the current AutoFilter range. Uses wildcard pattern matching ("text*") via CustomFilters with Equal operator.

Parameters

header System.String requiredposition: 0
startsWithText System.String requiredposition: 1
public Void AutoFilterClear() #
Returns: Void

Clears any AutoFilter from the worksheet.

public Void AutoFitColumn(Int32 columnIndex) #
Returns: Void

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

Parameters

columnIndex System.Int32 requiredposition: 0
1-based column index.
public Void AutoFitColumns(Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void

Automatically fits all columns based on their content.

Parameters

mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 0
Overrides how the auto-fit work is scheduled across columns.
ct System.Threading.CancellationToken = null optionalposition: 1
Cancels the auto-fit pass while widths are being measured or applied.
public Void AutoFitColumnsExcept(IEnumerable<Int32> columnsToSkip, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void

Automatically fits all columns except the supplied indexes.

Parameters

columnsToSkip System.Collections.Generic.IEnumerable{System.Int32} requiredposition: 0
1-based column indexes that should not be resized.
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 1
Overrides how the auto-fit work is scheduled for the remaining columns.
ct System.Threading.CancellationToken = null optionalposition: 2
Cancels the auto-fit pass before it completes.
public Void AutoFitColumnsFor(IEnumerable<Int32> columnIndexes, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void

Automatically fits the supplied set of column indexes.

Parameters

columnIndexes System.Collections.Generic.IEnumerable{System.Int32} requiredposition: 0
1-based column indexes that should be resized to fit their content.
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 1
Overrides how the auto-fit work is scheduled across the selected columns.
ct System.Threading.CancellationToken = null optionalposition: 2
Cancels the auto-fit pass for the selected columns.
public Void AutoFitRow(Int32 rowIndex) #
Returns: Void

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

Parameters

rowIndex System.Int32 requiredposition: 0
1-based row index.
public Void AutoFitRows(Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void

Automatically fits all rows based on their content.

Parameters

mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 0
Overrides how the auto-fit work is scheduled across rows.
ct System.Threading.CancellationToken = null optionalposition: 1
Cancels the row auto-fit pass while heights are being calculated or applied.
public Void Batch(Action<ExcelSheet> action) #
Returns: Void

Executes multiple worksheet mutations under a single workbook write lock.

Parameters

action System.Action{OfficeIMO.Excel.ExcelSheet} requiredposition: 0
The worksheet updates to execute.
public NoLockContext BeginNoLock() #
Returns: NoLockContext

Begin a no-lock context where operations bypass locking.

public Void Cell(Int32 row, Int32 column, Object value = null, String formula = null, String numberFormat = null) #
Returns: Void

Sets the value, formula, and number format of a cell in a single operation.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Object = null optionalposition: 2
Optional value to assign.
formula System.String = null optionalposition: 3
Optional formula to apply.
numberFormat System.String = null optionalposition: 4
Optional number format code.
public Void CellAlign(Int32 row, Int32 column, HorizontalAlignmentValues alignment) #
Returns: Void

Applies a horizontal alignment to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to align.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to align.
alignment DocumentFormat.OpenXml.Spreadsheet.HorizontalAlignmentValues requiredposition: 2
The horizontal alignment value to apply.
public ExcelCell CellAt(Int32 row, Int32 column) #
Returns: ExcelCell

Returns a lightweight object wrapper for a single cell.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
CellBackground 2 overloads
public Void CellBackground(Int32 row, Int32 column, OfficeColor color) #
Returns: Void

Applies solid background to a single cell. Accepts #RRGGBB or #AARRGGBB.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to fill.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to fill.
hexColor System.String requiredposition: 2
The background color expressed as an ARGB or RGB hex string.
CellBackground(System.Int32 row, System.Int32 column, OfficeIMO.Drawing.OfficeColor color) #

Applies solid background to a single cell using an OfficeIMO color.

Parameters

row System.Int32 required
The 1-based row index of the cell to fill.
column System.Int32 required
The 1-based column index of the cell to fill.
color OfficeIMO.Drawing.OfficeColor required
The OfficeColor to convert to a hex value.
public Void CellBold(Int32 row, Int32 column, Boolean bold = true) #
Returns: Void

Applies bold font to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to modify.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to modify.
bold System.Boolean = true optionalposition: 2
Whether the font should be bold (true) or regular (false).
public Void CellBorder(Int32 row, Int32 column, BorderStyleValues style, String hexColor = null) #
Returns: Void

Applies the same border style to all sides of a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to style.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to style.
style DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues requiredposition: 2
The border style to apply on all four sides.
hexColor System.String = null optionalposition: 3
Optional border color expressed as ARGB or RGB hex.
public Void CellDiagonalBorder(Int32 row, Int32 column, BorderStyleValues style, String hexColor = null, Boolean diagonalUp = true, Boolean diagonalDown = true) #
Returns: Void

Applies diagonal border lines to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to style.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to style.
style DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues requiredposition: 2
The diagonal border style.
hexColor System.String = null optionalposition: 3
Optional border color expressed as ARGB or RGB hex.
diagonalUp System.Boolean = true optionalposition: 4
Whether to draw the bottom-left to top-right diagonal.
diagonalDown System.Boolean = true optionalposition: 5
Whether to draw the top-left to bottom-right diagonal.
public Void CellFontColor(Int32 row, Int32 column, String hexColor) #
Returns: Void

Applies a font color (ARGB hex or #RRGGBB) to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to recolor.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to recolor.
hexColor System.String requiredposition: 2
The desired font color expressed as an ARGB or RGB hex string.
public Void CellFontName(Int32 row, Int32 column, String fontName) #
Returns: Void

Applies a font family name to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to modify.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to modify.
fontName System.String requiredposition: 2
The font family name to assign.
public Void CellFormula(Int32 row, Int32 column, String formula) #
Returns: Void

Sets a formula in the specified cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
formula System.String requiredposition: 2
The formula expression.
public Void CellItalic(Int32 row, Int32 column, Boolean italic = true) #
Returns: Void

Applies italic font styling to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to modify.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to modify.
italic System.Boolean = true optionalposition: 2
Whether the font should be italic (true) or regular (false).
public Void CellUnderline(Int32 row, Int32 column, Boolean underline = true) #
Returns: Void

Applies underline font styling to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to modify.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to modify.
underline System.Boolean = true optionalposition: 2
Whether the font should be underlined (true) or not (false).
CellValue 19 overloads
public Void CellValue<T>(Int32 row, Int32 column, Nullable<T> value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Type Parameters

T

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Object requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, String value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.String requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Double value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Double requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Single value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Single requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Decimal value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Decimal requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Int32 value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Int32 requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Int64 value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Int64 requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Int16 value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Int16 requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, DateTime value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.DateTime requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, DateTimeOffset value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.DateTimeOffset requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, DateOnly value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.DateOnly requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, TimeOnly value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.TimeOnly requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, TimeSpan value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.TimeSpan requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, UInt32 value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.UInt32 requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, UInt64 value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.UInt64 requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, UInt16 value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.UInt16 requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Byte value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Byte requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, SByte value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.SByte requiredposition: 2
The value to assign.
public Void CellValue(Int32 row, Int32 column, Boolean value) #
Returns: Void

Sets the specified value into a cell, inferring the data type.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
value System.Boolean requiredposition: 2
The value to assign.
public Void CellValues(IEnumerable<ValueTuple<Int32, Int32, Object>> cells, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void

Writes multiple cell values efficiently, using parallelization when beneficial.

Parameters

cells System.Collections.Generic.IEnumerable{System.ValueTuple{System.Int32,System.Int32,System.Object}} requiredposition: 0
Collection of cell coordinates and values.
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 1
Optional execution mode override.
ct System.Threading.CancellationToken = null optionalposition: 2
Cancellation token.
public Void CellValuesParallel(IEnumerable<ValueTuple<Int32, Int32, Object>> cells) #
Returns: Void
Obsolete("Use CellValues(..., ExecutionMode.Parallel) instead.")

Obsolete. Use CancellationToken) with Parallel instead.

Parameters

cells System.Collections.Generic.IEnumerable{System.ValueTuple{System.Int32,System.Int32,System.Object}} requiredposition: 0
Collection of cell coordinates and values.
CellValue``1(System.Int32 row, System.Int32 column, System.Nullable{``0} value) #

Sets the value of a cell using a nullable struct.

Type Parameters

T
The value type.

Parameters

row System.Int32 required
The 1-based row index.
column System.Int32 required
The 1-based column index.
value System.Nullable{``0} required
The nullable value to assign.
public Void CellVerticalAlign(Int32 row, Int32 column, VerticalAlignmentValues alignment) #
Returns: Void

Applies a vertical alignment to a single cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index of the cell to align.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to align.
alignment DocumentFormat.OpenXml.Spreadsheet.VerticalAlignmentValues requiredposition: 2
The vertical alignment value to apply.
public ChartBuilder Chart(String dataRangeA1) #
Returns: ChartBuilder

Starts a fluent chart definition from an A1 data range.

Parameters

dataRangeA1 System.String requiredposition: 0
public ChartBuilder ChartFromTable(String tableName) #
Returns: ChartBuilder

Starts a fluent chart definition from an existing table on this worksheet.

Parameters

tableName System.String requiredposition: 0
public ExcelChartGridLayout ChartLayout(Int32 row, Int32 column, Int32 widthPixels = 520, Int32 heightPixels = 320, Int32 chartsPerRow = 2, Int32 horizontalGapPixels = 48, Int32 verticalGapRows = 2) #
Returns: ExcelChartGridLayout

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

Parameters

row System.Int32 requiredposition: 0
One-based worksheet row for the first chart.
column System.Int32 requiredposition: 1
One-based worksheet column for the first chart.
widthPixels System.Int32 = 520 optionalposition: 2
Default chart width in pixels.
heightPixels System.Int32 = 320 optionalposition: 3
Default chart height in pixels.
chartsPerRow System.Int32 = 2 optionalposition: 4
Number of charts to place before wrapping to the next row.
horizontalGapPixels System.Int32 = 48 optionalposition: 5
Minimum horizontal gap between chart slots, in pixels, calculated against default-width Excel columns.
verticalGapRows System.Int32 = 2 optionalposition: 6
Minimum vertical gap between chart rows, in worksheet rows, calculated against default-height Excel rows.

Returns

A layout helper that produces chart placement slots.

public Void ClearArrayFormula(String a1RangeOrCell) #
Returns: Void

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

Parameters

a1RangeOrCell System.String requiredposition: 0
public Void ClearCachedFormulaResults() #
Returns: Void

Removes cached values from formula cells on this sheet.

ClearComment 2 overloads
public Void ClearComment(Int32 row, Int32 column) #
Returns: Void

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

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
public Void ClearComment(String a1) #
Returns: Void

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

Parameters

a1 System.String requiredposition: 0
A1 cell reference (e.g., "B5").
public Int32 ClearComments(ExcelCommentFilter filter) #
Returns: Int32

Removes comments that match the supplied filter.

Parameters

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

Returns

Number of comments removed.

public Void ClearConditionalFormatting(String a1Range = null) #
Returns: Void

Clears conditional formatting rules, optionally restricted to a range.

Parameters

a1Range System.String = null optionalposition: 0
public Void ClearHeaderCache() #
Returns: Void

Clears the cached header map.

public Void ClearRange(String a1Range, ExcelClearOptions options = All) #
Returns: Void

Clears selected parts of every cell and attached worksheet metadata in the range.

Parameters

a1Range System.String requiredposition: 0
options OfficeIMO.Excel.ExcelClearOptions = All optionalposition: 1
public Void ClearTableTotals(String tableOrRange) #
Returns: Void

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

Parameters

tableOrRange System.String requiredposition: 0
Table range, name, or display name.
CoerceForCellNoDom(System.Object arg1, OfficeIMO.Excel.SharedStringPlanner arg2) #

Compute-only coercion for parallel scenarios. Does not mutate DOM. Uses SharedStringPlanner for string values.

Parameters

arg1 System.Object required
arg2 OfficeIMO.Excel.SharedStringPlanner required
public ColumnStyleByHeaderBuilder ColumnStyleByHeader(String header, Boolean includeHeader = false, ExcelReadOptions options = null) #
Returns: ColumnStyleByHeaderBuilder

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 System.String requiredposition: 0
Header text used to resolve the target column after applying any configured normalization.
includeHeader System.Boolean = false optionalposition: 1
True to include the header row when styling; false to begin styling from the first data row.
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
Read options that control header normalization and other resolution behavior.
Commit() #

Persists pending changes on this worksheet to its underlying OpenXml part.

public virtual Void Dispose() #
Returns: Void

Releases resources held by this worksheet.

EnsureDefaultStylePrimitives(DocumentFormat.OpenXml.Spreadsheet.Stylesheet arg1) #

Ensures required default style primitives exist and their counts are consistent. Excel expects at least 1 Font, 2 Fills (None, Gray125), 1 Border, 1 CellStyleFormat, and 1 CellFormat present.

Parameters

arg1 DocumentFormat.OpenXml.Spreadsheet.Stylesheet required
EnsureValidUniqueTableName(System.String arg1, OfficeIMO.Excel.TableNameValidationMode arg2) #

Ensures a valid and unique table name according to OfficeIMO rules. Rules: - Allowed characters: letters, digits, underscore; spaces become underscores. - Names cannot start with a digit; an underscore is prefixed if necessary. - Names are scoped per workbook and checked case-insensitively. - When mode is Strict, throws for invalid input. Examples: - "My Table" โ‡’ "My_Table" - "Sales#2025" โ‡’ "Sales_2025" - "123Report" โ‡’ "_123Report" - If "Table" already exists, next becomes "Table2" ("Table3", ...)

Parameters

arg1 System.String required
arg2 OfficeIMO.Excel.TableNameValidationMode required
EnsureWorksheetElementOrder() #

Ensures all worksheet elements are in the correct order according to OpenXML schema. This must be called before saving to prevent validation errors.

ExecuteWithPolicy(System.String opName, System.Int32 itemCount, System.Nullable{OfficeIMO.Excel.ExecutionMode} overrideMode, System.Action sequentialCore, System.Action computeParallel, System.Action applySequential, System.Threading.CancellationToken ct) #

Core execution helper that handles a compute/apply split with optional parallelization. Compute runs without locks; only the apply stage is serialized under a document-level lock.

Parameters

opName System.String required
A short operation name used for diagnostics and policy decisions.
itemCount System.Int32 required
Approximate number of items to process; used to decide parallel vs sequential. This does not have to be exact but should reflect relative workload.
overrideMode System.Nullable{OfficeIMO.Excel.ExecutionMode} required
Force a specific execution mode (Sequential/Parallel); null to use policy (Automatic).
sequentialCore System.Action required
Single-threaded path. Used either when policy decides sequential or when compute/apply are not provided.
computeParallel System.Action required
Compute phase that is safe to run without locks and must not mutate the OpenXML DOM.
applySequential System.Action required
Apply phase that writes to the DOM. This runs once under a serialized lock.
ct System.Threading.CancellationToken required
Cancellation token for the compute phase.
public Void FillRange(String a1Range, String hexColor) #
Returns: Void

Applies a solid fill to every cell in the range.

Parameters

a1Range System.String requiredposition: 0
hexColor System.String requiredposition: 1
public IReadOnlyList<ExcelCommentInfo> FindComments(ExcelCommentFilter filter) #
Returns: IReadOnlyList<ExcelCommentInfo>

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

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter requiredposition: 0
Optional author, text, and A1 range filter.
public String FindFirst(String text) #
Returns: String

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 System.String requiredposition: 0
public Void ForEachColumn(String a1, Action<Int32> action) #
Returns: Void

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

Parameters

a1 System.String requiredposition: 0
A1 range without a sheet prefix.
action System.Action{System.Int32} requiredposition: 1
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<Int32> action) #
Returns: Void

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

Parameters

a1 System.String requiredposition: 0
A1 range without a sheet prefix.
action System.Action{System.Int32} requiredposition: 1
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

public Void FormatCell(Int32 row, Int32 column, String numberFormat) #
Returns: Void

Applies a number format to the specified cell.

Parameters

row System.Int32 requiredposition: 0
The 1-based row index.
column System.Int32 requiredposition: 1
The 1-based column index.
numberFormat System.String requiredposition: 2
The number format code to apply.
public Void FormatRange(String a1Range, String numberFormat) #
Returns: Void

Applies a number format to every cell in the range.

Parameters

a1Range System.String requiredposition: 0
numberFormat System.String requiredposition: 1
public Void Freeze(Int32 topRows = 0, Int32 leftCols = 0) #
Returns: Void

Freezes panes on the worksheet.

Parameters

topRows System.Int32 = 0 optionalposition: 0
Number of rows at the top to freeze.
leftCols System.Int32 = 0 optionalposition: 1
Number of columns on the left to freeze.
public String FromCsv(String csv, Int32 startRow = 1, Int32 startColumn = 1, Boolean firstRowIsHeader = true, Boolean includeHeaders = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

Inserts CSV text into the worksheet and returns the inserted range.

Parameters

csv System.String requiredposition: 0
startRow System.Int32 = 1 optionalposition: 1
startColumn System.Int32 = 1 optionalposition: 2
firstRowIsHeader System.Boolean = true optionalposition: 3
includeHeaders System.Boolean = true optionalposition: 4
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 5
ct System.Threading.CancellationToken = null optionalposition: 6
public String FromJson(String json, Int32 startRow = 1, Int32 startColumn = 1, Boolean includeHeaders = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

Inserts JSON array data into the worksheet and returns the inserted range.

Parameters

json System.String requiredposition: 0
startRow System.Int32 = 1 optionalposition: 1
startColumn System.Int32 = 1 optionalposition: 2
includeHeaders System.Boolean = true optionalposition: 3
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 4
ct System.Threading.CancellationToken = null optionalposition: 5
public IReadOnlyDictionary<String, String> GetAllNamedRanges() #
Returns: IReadOnlyDictionary<String, String>

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

public ExcelCellStyleSnapshot GetCellStyle(Int32 row, Int32 column) #
Returns: ExcelCellStyleSnapshot

Gets a read-only snapshot of the visual style assigned to a worksheet cell.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
public ExcelChart GetChart(String name) #
Returns: ExcelChart

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

Parameters

name System.String requiredposition: 0
public IReadOnlyList<ExcelColumnSnapshot> GetColumnDefinitions() #
Returns: IReadOnlyList<ExcelColumnSnapshot>

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

public IReadOnlyList<ExcelCommentInfo> GetComments() #
Returns: IReadOnlyList<ExcelCommentInfo>

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

public IReadOnlyList<ExcelConditionalFormattingInfo> GetConditionalFormattingRules(String a1Range = null) #
Returns: IReadOnlyList<ExcelConditionalFormattingInfo>

Lists conditional formatting rules on the worksheet.

Parameters

a1Range System.String = null optionalposition: 0
public IReadOnlyList<ExcelDataValidationInfo> GetDataValidations(String a1Range = null) #
Returns: IReadOnlyList<ExcelDataValidationInfo>

Lists data validation rules on the worksheet.

Parameters

a1Range System.String = null optionalposition: 0
public IReadOnlyList<ExcelFormulaCellInfo> GetFormulaCells() #
Returns: IReadOnlyList<ExcelFormulaCellInfo>

Returns formula cells on this sheet without changing workbook contents.

public String GetFormulaText(Int32 row, Int32 column) #
Returns: String

Returns the formula text from a cell, if present.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
public HeaderFooterSnapshot GetHeaderFooter() #
Returns: HeaderFooterSnapshot

Returns a snapshot of the current header and footer strings (odd pages) split into left/center/right sections, including flags and whether a picture placeholder (&G) is present.

public Dictionary<String, Int32> GetHeaderMap(ExcelReadOptions options = null) #
Returns: Dictionary<String, Int32>

Builds or returns a cached case-insensitive map of header name to 1-based column index using the first row of UsedRange. Cache is keyed by UsedRange A1 and NormalizeHeaders option.

Parameters

options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 0
public ExcelImage GetImage(String name) #
Returns: ExcelImage

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

Parameters

name System.String requiredposition: 0
public IReadOnlyList<Int32> GetManualColumnPageBreaks() #
Returns: IReadOnlyList<Int32>

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

public IReadOnlyList<Int32> GetManualRowPageBreaks() #
Returns: IReadOnlyList<Int32>

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

public IReadOnlyList<ExcelMergedRangeSnapshot> GetMergedRanges() #
Returns: IReadOnlyList<ExcelMergedRangeSnapshot>

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

public String GetNamedRange(String name) #
Returns: String

Gets the A1 range for the given defined name, scoped to this sheet when applicable.

Parameters

name System.String requiredposition: 0
Defined name to resolve.

Returns

A1 range (e.g. "A1:B5") or null if not found.

public ExcelSheetPageSetup GetPageSetup() #
Returns: ExcelSheetPageSetup

Reads worksheet page setup values used by print/export pipelines.

public IReadOnlyList<ExcelPivotTableInfo> GetPivotTables() #
Returns: IReadOnlyList<ExcelPivotTableInfo>

Returns pivot tables defined on this worksheet.

public String GetPrintArea() #
Returns: String

Gets the worksheet print area range, or null when no print area is configured.

public ExcelPrintTitles GetPrintTitles() #
Returns: ExcelPrintTitles

Gets worksheet print title rows and columns.

public ValueTuple<Int32, Int32, Int32, Int32> GetRangeBounds(String a1) #
Returns: ValueTuple<Int32, Int32, Int32, Int32>

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

Parameters

a1 System.String requiredposition: 0
A1 range without a sheet prefix (e.g., "A2:D20").

Returns

Tuple of (r1, c1, r2, c2) with normalized bounds.

Exceptions

  • ArgumentException โ€“ Thrown when the input is not a valid A1 range.
public IReadOnlyList<ExcelRichTextRun> GetRichText(Int32 row, Int32 column) #
Returns: IReadOnlyList<ExcelRichTextRun>

Reads rich inline text runs from a cell.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
public IReadOnlyList<ExcelRowSnapshot> GetRowDefinitions() #
Returns: IReadOnlyList<ExcelRowSnapshot>

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

public String GetTableRange(String tableName) #
Returns: String

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

Parameters

tableName System.String requiredposition: 0
Table name or display name.

Returns

The table reference, or null when no matching table exists.

public String GetUsedRangeA1() #
Returns: String

Returns the used range of this worksheet as an A1 string by leveraging the read bridge.

GuessLinkDisplay(System.String arg1) #

Parameters

arg1 System.String required

Examples

sheet.SetHyperlinkHost(7, 1, "https://learn.microsoft.com/office/open-xml/"); // displays "learn.microsoft.com"

public Boolean HasComment(Int32 row, Int32 column) #
Returns: Boolean

Returns true when a comment exists for the specified cell.

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
public Void HeaderFooter(Action<HeaderFooterBuilder> configure) #
Returns: Void

Fluent header/footer configuration using the same builder as SheetComposer.

Parameters

configure System.Action{OfficeIMO.Excel.Fluent.HeaderFooterBuilder} requiredposition: 0
public Void HeaderLogoUrl(String url, HeaderFooterPosition position = Right, Nullable<Double> widthPoints = null, Nullable<Double> heightPoints = null, String leftText = null, String centerText = null, String rightText = null) #
Returns: Void

Convenience: sets a header logo from URL in the given position. Optional page text can be supplied.

Parameters

url System.String requiredposition: 0
position OfficeIMO.Excel.HeaderFooterPosition = Right optionalposition: 1
widthPoints System.Nullable{System.Double} = null optionalposition: 2
heightPoints System.Nullable{System.Double} = null optionalposition: 3
leftText System.String = null optionalposition: 4
centerText System.String = null optionalposition: 5
rightText System.String = null optionalposition: 6
public String InsertDataReader(IDataReader reader, Int32 startRow = 1, Int32 startColumn = 1, Boolean includeHeaders = true, String tableName = null, TableStyle style = TableStyleMedium2, Boolean includeAutoFilter = true, Boolean createTable = true, Boolean autoFit = false, CancellationToken ct = null) #
Returns: String

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.

Parameters

reader System.Data.IDataReader requiredposition: 0
Open data reader positioned before the first row.
startRow System.Int32 = 1 optionalposition: 1
1-based start row.
startColumn System.Int32 = 1 optionalposition: 2
1-based start column.
includeHeaders System.Boolean = true optionalposition: 3
Write field names as the first row.
tableName System.String = null optionalposition: 4
Optional Excel table name.
style OfficeIMO.Excel.TableStyle = TableStyleMedium2 optionalposition: 5
Excel table style to use when createTable is true.
includeAutoFilter System.Boolean = true optionalposition: 6
Include table AutoFilter dropdowns when creating a table.
createTable System.Boolean = true optionalposition: 7
Create an Excel table over the imported range.
autoFit System.Boolean = false optionalposition: 8
Auto-fit imported columns after rows are written.
ct System.Threading.CancellationToken = null optionalposition: 9
Cancellation token.

Returns

A1 range occupied by the imported reader data.

public Void InsertDataTable(DataTable table, Int32 startRow = 1, Int32 startColumn = 1, Boolean includeHeaders = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void

Inserts a DataTable into the worksheet starting at the specified cell. Uses the batch CellValues compute/apply model with SharedString and Style planners.

Parameters

table System.Data.DataTable requiredposition: 0
Source DataTable.
startRow System.Int32 = 1 optionalposition: 1
1-based start row.
startColumn System.Int32 = 1 optionalposition: 2
1-based start column.
includeHeaders System.Boolean = true optionalposition: 3
Whether to write column headers.
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 4
Optional execution mode override.
ct System.Threading.CancellationToken = null optionalposition: 5
Cancellation token.
public String InsertDataTableAsTable(DataTable table, Int32 startRow = 1, Int32 startColumn = 1, Boolean includeHeaders = true, String tableName = null, TableStyle style = TableStyleMedium2, Boolean includeAutoFilter = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

Inserts a DataTable and immediately creates an Excel Table over the written range. Returns the A1-style range of the created table.

Parameters

table System.Data.DataTable requiredposition: 0
startRow System.Int32 = 1 optionalposition: 1
startColumn System.Int32 = 1 optionalposition: 2
includeHeaders System.Boolean = true optionalposition: 3
tableName System.String = null optionalposition: 4
style OfficeIMO.Excel.TableStyle = TableStyleMedium2 optionalposition: 5
includeAutoFilter System.Boolean = true optionalposition: 6
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 7
ct System.Threading.CancellationToken = null optionalposition: 8
public Void InsertObjects<T>(IEnumerable<T> items, Boolean includeHeaders, Int32 startRow, params ValueTuple<String, Func<T, Object>>[] columns) #
Returns: Void

Type Parameters

T

Parameters

items IEnumerable<T> requiredposition: 0
includeHeaders Boolean = true requiredposition: 1
startRow Int32 = 1 requiredposition: 2
InsertObjects``1 3 overloads
InsertObjects``1(System.Collections.Generic.IEnumerable{``0} items, System.Boolean includeHeaders, System.Int32 startRow) #

Inserts objects into the worksheet by flattening their properties into columns.

Type Parameters

T
Type of objects being inserted.

Parameters

items System.Collections.Generic.IEnumerable{``0} required
Collection of objects to insert.
includeHeaders System.Boolean required
Whether to include column headers.
startRow System.Int32 required
1-based starting row.
InsertObjects``1(System.Collections.Generic.IEnumerable{``0} items, System.ValueTuple{System.String,System.Func{``0,System.Object}}[] columns) #

Inserts objects into the worksheet using explicit column selectors (AOT-safe).

Type Parameters

T
Type of objects being inserted.

Parameters

items System.Collections.Generic.IEnumerable{``0} required
Collection of objects to insert.
columns System.ValueTuple{System.String,System.Func{``0,System.Object}}[] required
Column headers and selectors.
InsertObjects``1(System.Collections.Generic.IEnumerable{``0} items, System.Boolean includeHeaders, System.Int32 startRow, System.ValueTuple{System.String,System.Func{``0,System.Object}}[] columns) #

Inserts objects into the worksheet using explicit column selectors (AOT-safe).

Type Parameters

T
Type of objects being inserted.

Parameters

items System.Collections.Generic.IEnumerable{``0} required
Collection of objects to insert.
includeHeaders System.Boolean required
Whether to include column headers.
startRow System.Int32 required
1-based starting row.
columns System.ValueTuple{System.String,System.Func{``0,System.Object}}[] required
Column headers and selectors.
public ExcelFormulaInspection InspectFormulas() #
Returns: ExcelFormulaInspection

Inspects formula cells on this sheet without changing workbook contents.

InspectTemplate 3 overloads
public ExcelTemplateInspection InspectTemplate() #
Returns: ExcelTemplateInspection

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

public ExcelTemplateInspection InspectTemplate(IDictionary<String, Object> values) #
Returns: ExcelTemplateInspection

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

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
public ExcelTemplateInspection InspectTemplate(Object model) #
Returns: ExcelTemplateInspection

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

Parameters

model System.Object requiredposition: 0
public Void InvalidateFormulas() #
Returns: Void

Marks all formula cells on this sheet dirty.

public Void LinkByHeaderToInternalSheets(String header, Int32 rowFrom = 2, Int32 rowTo = -1, Func<String, String> destinationSheetForCellText = null, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #
Returns: Void

Links a column identified by header to internal sheets using each cell's text. Defaults to linking to a sheet with the same name as the cell text. When the header is missing the operation is skipped.

Parameters

header System.String requiredposition: 0
Header text of the column to process.
rowFrom System.Int32 = 2 optionalposition: 1
First data row (1-based). Defaults to 2 (skip header).
rowTo System.Int32 = -1 optionalposition: 2
Last data row (inclusive). When <= 0, uses the bottom of the used range.
destinationSheetForCellText System.Func{System.String,System.String} = null optionalposition: 3
Maps cell text to a destination sheet name; defaults to identity.
targetA1 System.String = "A1" optionalposition: 4
Destination cell on the target sheet (default "A1").
display System.Func{System.String,System.String} = null optionalposition: 5
Optional display selector; defaults to the cell text.
styled System.Boolean = true optionalposition: 6
Apply hyperlink styling (blue + underline).
public Void LinkByHeaderToInternalSheetsInRange(String rangeA1, String header, Func<String, String> destinationSheetForCellText = null, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #
Returns: Void

Links a column identified by header within a rectangular A1 range to internal sheets. Uses the first row of the range as the header row and links rows r1+1..r2.

Parameters

rangeA1 System.String requiredposition: 0
A1 range (e.g., "A1:D50"). The first row is treated as the header row.
header System.String requiredposition: 1
Header text to match (case-insensitive).
destinationSheetForCellText System.Func{System.String,System.String} = null optionalposition: 2
Maps cell text to destination sheet name (defaults to identity).
targetA1 System.String = "A1" optionalposition: 3
Destination cell on the target sheet (default "A1").
display System.Func{System.String,System.String} = null optionalposition: 4
Optional display selector; defaults to the cell text.
styled System.Boolean = true optionalposition: 5
Apply hyperlink styling (blue + underline).
public Void LinkByHeaderToInternalSheetsInTable(String tableName, String header, Func<String, String> destinationSheetForCellText = null, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #
Returns: Void

Links a column within a table to internal sheets. The table range determines the row bounds.

Parameters

tableName System.String requiredposition: 0
Name of the table (as shown in Excel's Name Manager).
header System.String requiredposition: 1
Header text of the column inside the table.
destinationSheetForCellText System.Func{System.String,System.String} = null optionalposition: 2
Maps cell text to a destination sheet name (defaults to identity).
targetA1 System.String = "A1" optionalposition: 3
Destination cell on the target sheet (default "A1").
display System.Func{System.String,System.String} = null optionalposition: 4
Optional display selector; defaults to the cell text.
styled System.Boolean = true optionalposition: 5
Apply hyperlink styling (blue + underline).

Examples

// Internal: link "Domain" column to same-named sheets, rows 2..used bottom sheet.LinkByHeaderToInternalSheets("Domain"); // External: link "RFC" column to IETF datatracker pages sheet.LinkByHeaderToUrls("RFC", urlForCellText: rfc => $"https://datatracker.ietf.org/doc/html/{rfc}");

public Void LinkByHeaderToUrls(String header, Int32 rowFrom = 2, Int32 rowTo = -1, Func<String, String> urlForCellText = null, Func<String, String> titleForCellText = null, Boolean styled = true) #
Returns: Void

Links a column identified by header to external URLs built from each cell's text. When the header is missing the operation is skipped.

Parameters

header System.String requiredposition: 0
Header text of the column to process.
rowFrom System.Int32 = 2 optionalposition: 1
First data row (1-based). Defaults to 2 (skip header).
rowTo System.Int32 = -1 optionalposition: 2
Last data row (inclusive). When <= 0, uses the bottom of the used range.
urlForCellText System.Func{System.String,System.String} = null optionalposition: 3
Maps cell text to URL.
titleForCellText System.Func{System.String,System.String} = null optionalposition: 4
Optional display selector; when null, a smart display (RFC/host) is used.
styled System.Boolean = true optionalposition: 5
Apply hyperlink styling (blue + underline).
public Void LinkByHeaderToUrlsInRange(String rangeA1, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #
Returns: Void

Links a column identified by header within a rectangular A1 range to external URLs. Uses the first row of the range as the header row and links rows r1+1..r2.

Parameters

rangeA1 System.String requiredposition: 0
A1 range (e.g., "A1:D50"). The first row is treated as the header row.
header System.String requiredposition: 1
Header text to match (case-insensitive).
urlForCellText System.Func{System.String,System.String} requiredposition: 2
Maps cell text to URL.
titleForCellText System.Func{System.String,System.String} = null optionalposition: 3
Optional display selector; when null, a smart display (RFC/host) is used.
styled System.Boolean = true optionalposition: 4
Apply hyperlink styling (blue + underline).
public Void LinkByHeaderToUrlsInTable(String tableName, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #
Returns: Void

Links a column within a table to external URLs. The table range determines the row bounds.

Parameters

tableName System.String requiredposition: 0
Name of the table.
header System.String requiredposition: 1
Header text of the column inside the table.
urlForCellText System.Func{System.String,System.String} requiredposition: 2
Maps cell text to URL.
titleForCellText System.Func{System.String,System.String} = null optionalposition: 3
Optional display selector; when null, a smart display (RFC/host) is used.
styled System.Boolean = true optionalposition: 4
Apply hyperlink styling (blue + underline).
public Void LinkCellsToInternalSheets(String a1, Func<String, String> destinationSheetForCellText, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #
Returns: Void

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 System.String requiredposition: 0
A1 range to process (e.g., a column of names).
destinationSheetForCellText System.Func{System.String,System.String} requiredposition: 1
Maps the cell text to a destination sheet name.
targetA1 System.String = "A1" optionalposition: 2
Destination cell on the target sheet (default "A1").
display System.Func{System.String,System.String} = null optionalposition: 3
Optional display text selector. Defaults to the cell text.
styled System.Boolean = true optionalposition: 4
When true, applies hyperlink styling (blue + underline).

Examples

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

LoadVmlXDocument(System.IO.Stream arg1) #

Loads workbook VML XML parts with external entities disabled and bounded document size.

Parameters

arg1 System.IO.Stream required
public Void MergeRange(String a1Range) #
Returns: Void

Merges the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
public PivotTableBuilder Pivot(String sourceRange) #
Returns: PivotTableBuilder

Starts a fluent pivot table definition from an A1 source range.

Parameters

sourceRange System.String requiredposition: 0
Source data range including headers, for example A1:D100.
Preflight() #

Removes empty containers and orphaned references on this worksheet to prevent Excel repairs.

public Void Protect(ExcelSheetProtectionOptions options = null) #
Returns: Void

Applies worksheet protection using the provided options.

Parameters

options OfficeIMO.Excel.ExcelSheetProtectionOptions = null optionalposition: 0
Protection options (defaults allow selection of locked/unlocked cells).
public ExcelRange Range(String a1Range) #
Returns: ExcelRange

Returns a lightweight object wrapper for an A1 range.

Parameters

a1Range System.String requiredposition: 0
public Int32 RecalculateSupportedFormulas() #
Returns: Int32

Evaluates supported formulas on this sheet and writes cached results.

public Void RefreshHeaderCache(ExcelReadOptions options = null) #
Returns: Void

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

Parameters

options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 0
public Void RemoveDataValidations(String a1Range = null) #
Returns: Void

Removes data validation rules, optionally restricted to a range.

Parameters

a1Range System.String = null optionalposition: 0
public Boolean RemoveNamedRange(String name, Boolean save = true) #
Returns: Boolean

Removes a defined name scoped to this sheet.

Parameters

name System.String requiredposition: 0
Defined name to remove.
save System.Boolean = true optionalposition: 1
When true, saves the workbook after removal.

Returns

True if removed; false if not found.

public Int32 RemoveTemplateOptionalRows(Int32 firstRow, Int32 rowCount) #
Returns: Int32

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

Parameters

firstRow System.Int32 requiredposition: 0
1-based first row in the optional block.
rowCount System.Int32 requiredposition: 1
Number of rows in the optional block.
public Int32 ReplaceAll(String oldText, String newText) #
Returns: Int32

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

Parameters

oldText System.String requiredposition: 0
newText System.String requiredposition: 1
Rows 2 overloads
public IEnumerable<Dictionary<String, Object>> Rows(ExcelReadOptions options = null) #
Returns: IEnumerable<Dictionary<String, Object>>

Reads the sheet's used range as a sequence of dictionaries using the first row as headers.

Parameters

options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 0
Optional read options/presets.
public IEnumerable<Dictionary<String, Object>> Rows(String a1Range, ExcelReadOptions options = null) #
Returns: IEnumerable<Dictionary<String, Object>>

Reads the specified A1 range as a sequence of dictionaries using the first row of the range as headers.

Parameters

a1Range System.String requiredposition: 0
Inclusive A1 range (e.g., "A1:C100").
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
Optional read options/presets.
public IEnumerable<T> RowsAs<T>(String a1Range, ExcelReadOptions options = null) #
Returns: IEnumerable<T>

Type Parameters

T

Parameters

a1Range String requiredposition: 0
options ExcelReadOptions = null optionalposition: 1
public IEnumerable<T> RowsAsStream<T>(String a1Range, ExcelReadOptions options = null, CancellationToken ct = null) #
Returns: IEnumerable<T>

Type Parameters

T

Parameters

a1Range String requiredposition: 0
options ExcelReadOptions = null optionalposition: 1
ct CancellationToken = null optionalposition: 2
RowsAsStream``1(System.String a1Range, OfficeIMO.Excel.ExcelReadOptions options, System.Threading.CancellationToken ct) #

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

Parameters

a1Range System.String required
options OfficeIMO.Excel.ExcelReadOptions required
ct System.Threading.CancellationToken required
RowsAs``1(System.String a1Range, OfficeIMO.Excel.ExcelReadOptions options) #

Maps the specified A1 range to a sequence of T using header-to-property mapping.

Parameters

a1Range System.String required
options OfficeIMO.Excel.ExcelReadOptions required
RowsObjects 2 overloads
public IEnumerable<RowEdit> RowsObjects(ExcelReadOptions options = null) #
Returns: IEnumerable<RowEdit>

Reads the sheet's used range as editable rows. First row is treated as headers.

Parameters

options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 0
public IEnumerable<RowEdit> RowsObjects(String a1Range, ExcelReadOptions options = null) #
Returns: IEnumerable<RowEdit>

Reads the specified A1 range as editable rows. First row is treated as headers.

Parameters

a1Range System.String requiredposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
public Void SetArrayFormula(String a1Range, String formula) #
Returns: Void

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

Parameters

a1Range System.String requiredposition: 0
formula System.String requiredposition: 1
public Void SetByHeader(Int32 rowIndex, String header, Object value, ExcelReadOptions options = null) #
Returns: Void

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 System.Int32 requiredposition: 0
header System.String requiredposition: 1
value System.Object requiredposition: 2
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 3
public Void SetCellValues(IEnumerable<ValueTuple<Int32, Int32, Object>> cells, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: Void
Obsolete("Use CellValues(...) instead.")

Obsolete. Use CancellationToken) instead.

Parameters

cells System.Collections.Generic.IEnumerable{System.ValueTuple{System.Int32,System.Int32,System.Object}} requiredposition: 0
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 1
ct System.Threading.CancellationToken = null optionalposition: 2
public Void SetColumnHidden(Int32 columnIndex, Boolean hidden) #
Returns: Void

Hides or shows the specified column.

Parameters

columnIndex System.Int32 requiredposition: 0
1-based column index.
hidden System.Boolean requiredposition: 1
True to hide the column; false to show it.
public Void SetColumnWidth(Int32 columnIndex, Double width) #
Returns: Void

Sets the width of the specified column.

Parameters

columnIndex System.Int32 requiredposition: 0
1-based column index.
width System.Double requiredposition: 1
The column width.
SetComment 2 overloads
public Void SetComment(Int32 row, Int32 column, String text, String author = "OfficeIMO", String initials = null) #
Returns: Void

Adds or replaces a comment on the specified cell.

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
text System.String requiredposition: 2
Comment text.
author System.String = "OfficeIMO" optionalposition: 3
Author name (optional).
initials System.String = null optionalposition: 4
Author initials (optional).
public Void SetComment(String a1, String text, String author = "OfficeIMO", String initials = null) #
Returns: Void

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

Parameters

a1 System.String requiredposition: 0
A1 cell reference (e.g., "B5").
text System.String requiredposition: 1
Comment text.
author System.String = "OfficeIMO" optionalposition: 2
Author name (optional).
initials System.String = null optionalposition: 3
Author initials (optional).
SetCommentRichText 2 overloads
public Void SetCommentRichText(Int32 row, Int32 column, IEnumerable<ExcelRichTextRun> runs, String author = "OfficeIMO", String initials = null) #
Returns: Void

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

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun} requiredposition: 2
Rich text runs that make up the comment text.
author System.String = "OfficeIMO" optionalposition: 3
Author name (optional).
initials System.String = null optionalposition: 4
Author initials (optional).
public Void SetCommentRichText(String a1, IEnumerable<ExcelRichTextRun> runs, String author = "OfficeIMO", String initials = null) #
Returns: Void

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

Parameters

a1 System.String requiredposition: 0
A1 cell reference (e.g., "B5").
runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun} requiredposition: 1
Rich text runs that make up the comment text.
author System.String = "OfficeIMO" optionalposition: 2
Author name (optional).
initials System.String = null optionalposition: 3
Author initials (optional).
public Void SetDataValidationMessages(String a1Range, ExcelDataValidationMessageOptions options) #
Returns: Void

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

Parameters

a1Range System.String requiredposition: 0
options OfficeIMO.Excel.ExcelDataValidationMessageOptions requiredposition: 1
public Void SetEvenPageHeaderFooter(String headerLeft = null, String headerCenter = null, String headerRight = null, String footerLeft = null, String footerCenter = null, String footerRight = null, Boolean enabled = true) #
Returns: Void

Sets an even-page header and/or footer variant for this worksheet.

Parameters

headerLeft System.String = null optionalposition: 0
headerCenter System.String = null optionalposition: 1
headerRight System.String = null optionalposition: 2
footerLeft System.String = null optionalposition: 3
footerCenter System.String = null optionalposition: 4
footerRight System.String = null optionalposition: 5
enabled System.Boolean = true optionalposition: 6
public Void SetFirstPageHeaderFooter(String headerLeft = null, String headerCenter = null, String headerRight = null, String footerLeft = null, String footerCenter = null, String footerRight = null, Boolean enabled = true) #
Returns: Void

Sets a first-page header and/or footer variant for this worksheet.

Parameters

headerLeft System.String = null optionalposition: 0
headerCenter System.String = null optionalposition: 1
headerRight System.String = null optionalposition: 2
footerLeft System.String = null optionalposition: 3
footerCenter System.String = null optionalposition: 4
footerRight System.String = null optionalposition: 5
enabled System.Boolean = true optionalposition: 6
public Void SetFooterImage(HeaderFooterPosition position, Byte[] imageBytes, String contentType = "image/png", Nullable<Double> widthPoints = null, Nullable<Double> heightPoints = null) #
Returns: Void

Adds an image to the worksheet footer at the given position. This will also ensure the footer text contains the picture placeholder (&G) in the corresponding section. Subsequent calls replace any previously set header/footer images for this sheet.

Parameters

position OfficeIMO.Excel.HeaderFooterPosition requiredposition: 0
imageBytes System.Byte[] requiredposition: 1
contentType System.String = "image/png" optionalposition: 2
widthPoints System.Nullable{System.Double} = null optionalposition: 3
heightPoints System.Nullable{System.Double} = null optionalposition: 4
public Void SetFooterImageUrl(HeaderFooterPosition position, String url, Nullable<Double> widthPoints = null, Nullable<Double> heightPoints = null) #
Returns: Void

Downloads an image from URL and sets it in the footer at the given position (convenience wrapper).

Parameters

position OfficeIMO.Excel.HeaderFooterPosition requiredposition: 0
url System.String requiredposition: 1
widthPoints System.Nullable{System.Double} = null optionalposition: 2
heightPoints System.Nullable{System.Double} = null optionalposition: 3
public Void SetGridlinesVisible(Boolean visible) #
Returns: Void

Shows or hides gridlines on the current sheet (view-level setting).

Parameters

visible System.Boolean requiredposition: 0
public Void SetHeaderFooter(String headerLeft = null, String headerCenter = null, String headerRight = null, String footerLeft = null, String footerCenter = null, String footerRight = null, Boolean differentFirstPage = false, Boolean differentOddEven = false, Boolean alignWithMargins = true, Boolean scaleWithDoc = true) #
Returns: Void

Sets the header and/or footer text for this worksheet.

Parameters

headerLeft System.String = null optionalposition: 0
Left header text (optional).
headerCenter System.String = null optionalposition: 1
Center header text (optional).
headerRight System.String = null optionalposition: 2
Right header text (optional).
footerLeft System.String = null optionalposition: 3
Left footer text (optional).
footerCenter System.String = null optionalposition: 4
Center footer text (optional).
footerRight System.String = null optionalposition: 5
Right footer text (optional).
differentFirstPage System.Boolean = false optionalposition: 6
Use a different header/footer on the first page.
differentOddEven System.Boolean = false optionalposition: 7
Use different headers/footers for odd and even pages.
alignWithMargins System.Boolean = true optionalposition: 8
Align header/footer with page margins.
scaleWithDoc System.Boolean = true optionalposition: 9
Scale header/footer with document scaling.
public Void SetHeaderImage(HeaderFooterPosition position, Byte[] imageBytes, String contentType = "image/png", Nullable<Double> widthPoints = null, Nullable<Double> heightPoints = null) #
Returns: Void

Adds an image to the worksheet header at the given position. This will also ensure the header text contains the picture placeholder (&G) in the corresponding section. Subsequent calls replace any previously set header/footer images for this sheet.

Parameters

position OfficeIMO.Excel.HeaderFooterPosition requiredposition: 0
Left, Center, or Right header section.
imageBytes System.Byte[] requiredposition: 1
Image bytes.
contentType System.String = "image/png" optionalposition: 2
e.g. image/png, image/jpeg. Defaults to image/png.
widthPoints System.Nullable{System.Double} = null optionalposition: 3
Optional width in points. If omitted, inferred from image size at 96 DPI.
heightPoints System.Nullable{System.Double} = null optionalposition: 4
Optional height in points. If omitted, inferred proportionally.
public Void SetHeaderImageUrl(HeaderFooterPosition position, String url, Nullable<Double> widthPoints = null, Nullable<Double> heightPoints = null) #
Returns: Void

Downloads an image from URL and sets it in the header at the given position (convenience wrapper).

Parameters

position OfficeIMO.Excel.HeaderFooterPosition requiredposition: 0
url System.String requiredposition: 1
widthPoints System.Nullable{System.Double} = null optionalposition: 2
heightPoints System.Nullable{System.Double} = null optionalposition: 3
public Void SetHidden(Boolean hidden) #
Returns: Void

Hides or shows the worksheet in the workbook.

Parameters

hidden System.Boolean requiredposition: 0
SetHyperlink 2 overloads
public Void SetHyperlinkHost(Int32 row, Int32 column, String url, Boolean style = true) #
Returns: Void

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

Parameters

row System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
url System.String requiredposition: 2
Target URL.
style System.Boolean = true optionalposition: 3
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 SetHyperlinkSmart(Int32 row, Int32 column, String url, String title = null, Boolean style = true) #
Returns: Void

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 System.Int32 requiredposition: 0
1-based row index.
column System.Int32 requiredposition: 1
1-based column index.
url System.String requiredposition: 2
Target URL.
title System.String = null optionalposition: 3
Optional preferred display text.
style System.Boolean = true optionalposition: 4
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);

SetInternalLink 2 overloads
public Void SetMargins(Double left, Double right, Double top, Double bottom, Double header = 0.3, Double footer = 0.3) #
Returns: Void

Sets page margins in inches.

Parameters

left System.Double requiredposition: 0
right System.Double requiredposition: 1
top System.Double requiredposition: 2
bottom System.Double requiredposition: 3
header System.Double = 0.3 optionalposition: 4
footer System.Double = 0.3 optionalposition: 5
public Void SetMarginsPreset(ExcelMarginPreset preset) #
Returns: Void

Applies a preset set of margins.

Parameters

preset OfficeIMO.Excel.ExcelMarginPreset requiredposition: 0
SetNamedRange 2 overloads
public Void SetNamedRange(String name, String range, Boolean save = true, Boolean hidden = false) #
Returns: Void

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

Parameters

name System.String requiredposition: 0
Defined name to create or update.
range System.String requiredposition: 1
A1 range (e.g. "A1:B5").
save System.Boolean = true optionalposition: 2
When true, saves the workbook after the change.
hidden System.Boolean = false optionalposition: 3
When true, marks the defined name as hidden.
public Void SetNamedRange(String name, String range, Boolean save, Boolean hidden, NameValidationMode validationMode) #
Returns: Void

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

Parameters

name System.String requiredposition: 0
Defined name to create or update.
range System.String requiredposition: 1
A1 range (e.g. "A1:B5").
save System.Boolean requiredposition: 2
When true, saves the workbook after the change.
hidden System.Boolean requiredposition: 3
When true, marks the defined name as hidden.
validationMode OfficeIMO.Excel.NameValidationMode requiredposition: 4
Controls how the name and range are validated: Sanitize (default) clamps/adjusts; Strict throws on invalid input.
public Void SetOrientation(ExcelPageOrientation orientation) #
Returns: Void

Sets page orientation (Portrait or Landscape) on the sheet's PageSetup.

Parameters

orientation OfficeIMO.Excel.ExcelPageOrientation requiredposition: 0
public Void SetPageSetup(Nullable<UInt32> fitToWidth = null, Nullable<UInt32> fitToHeight = null, Nullable<UInt32> scale = null) #
Returns: Void

Configures basic print/page setup for the sheet.

Parameters

fitToWidth System.Nullable{System.UInt32} = null optionalposition: 0
Number of pages to fit horizontally (1 = fit to one page).
fitToHeight System.Nullable{System.UInt32} = null optionalposition: 1
Number of pages to fit vertically (0 = unlimited).
scale System.Nullable{System.UInt32} = null optionalposition: 2
Manual scale (10-400). Ignored if FitToWidth/Height are specified.
public Void SetRichText(Int32 row, Int32 column, IEnumerable<ExcelRichTextRun> runs) #
Returns: Void

Writes rich inline text runs into a cell.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun} requiredposition: 2
public Void SetRowHeight(Int32 rowIndex, Double height) #
Returns: Void

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

Parameters

rowIndex System.Int32 requiredposition: 0
1-based row index.
height System.Double requiredposition: 1
Row height in points.
public Void SetRowHidden(Int32 rowIndex, Boolean hidden) #
Returns: Void

Sets whether the specified row is hidden.

Parameters

rowIndex System.Int32 requiredposition: 0
1-based row index.
hidden System.Boolean requiredposition: 1
True to hide the row; false to show it.
public Void SetTableStyle(String tableOrRange, TableStyle style, Nullable<Boolean> showFirstColumn = null, Nullable<Boolean> showLastColumn = null, Nullable<Boolean> showRowStripes = null, Nullable<Boolean> showColumnStripes = null) #
Returns: Void

Updates the visual style flags for the table identified by range, name, or display name.

Parameters

tableOrRange System.String requiredposition: 0
Table range, name, or display name.
style OfficeIMO.Excel.TableStyle requiredposition: 1
Table style to apply.
showFirstColumn System.Nullable{System.Boolean} = null optionalposition: 2
Optional first-column emphasis flag.
showLastColumn System.Nullable{System.Boolean} = null optionalposition: 3
Optional last-column emphasis flag.
showRowStripes System.Nullable{System.Boolean} = null optionalposition: 4
Optional row stripe flag.
showColumnStripes System.Nullable{System.Boolean} = null optionalposition: 5
Optional column stripe flag.
public Void SetTableTotals(String range, Dictionary<String, TotalsRowFunctionValues> byHeader) #
Returns: Void

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.).

Parameters

range System.String requiredposition: 0
Address of the table range (for example, "A1:D10") whose totals row should be displayed.
byHeader System.Collections.Generic.Dictionary{System.String,DocumentFormat.OpenXml.Spreadsheet.TotalsRowFunctionValues} requiredposition: 1
Mapping of table header names to the totals function that should be applied for each column.
public Void SetTableTotalsByName(String tableName, IDictionary<String, TotalsRowFunctionValues> byHeader) #
Returns: Void

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

Parameters

tableName System.String requiredposition: 0
Table name or display name.
byHeader System.Collections.Generic.IDictionary{System.String,DocumentFormat.OpenXml.Spreadsheet.TotalsRowFunctionValues} requiredposition: 1
Mapping of table header names to totals functions.
public Void SortRangeByColumn(String a1Range, Int32 columnOffset, Boolean ascending = true, Boolean hasHeader = true) #
Returns: Void

Sorts a rectangular range by a 1-based column offset while moving whole row cell nodes.

Parameters

a1Range System.String requiredposition: 0
columnOffset System.Int32 requiredposition: 1
ascending System.Boolean = true optionalposition: 2
hasHeader System.Boolean = true optionalposition: 3
public Void SortUsedRangeByHeader(String header, Boolean ascending = true) #
Returns: Void

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 System.String requiredposition: 0
ascending System.Boolean = true optionalposition: 1
public Void SortUsedRangeByHeaders(params ValueTuple<String, Boolean>[] keys) #
Returns: Void

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{System.String,System.Boolean}[] requiredposition: 0
public SparklineBuilder Sparklines(String dataRange) #
Returns: SparklineBuilder

Starts a fluent sparkline definition from an A1 data range.

Parameters

dataRange System.String requiredposition: 0
public ExcelTable Table(String nameOrRange) #
Returns: ExcelTable

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

Parameters

nameOrRange System.String requiredposition: 0
public String TableToCsv(String tableName, Nullable<Boolean> headersInFirstRow = null, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

Reads an Excel table and returns CSV text.

Parameters

tableName System.String requiredposition: 0
headersInFirstRow System.Nullable{System.Boolean} = null optionalposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
ct System.Threading.CancellationToken = null optionalposition: 4
public DataTable TableToDataTable(String tableName, Nullable<Boolean> headersInFirstRow = null, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: DataTable

Reads an Excel table as a DataTable.

Parameters

tableName System.String requiredposition: 0
headersInFirstRow System.Nullable{System.Boolean} = null optionalposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
ct System.Threading.CancellationToken = null optionalposition: 4
public String TableToJson(String tableName, Nullable<Boolean> headersInFirstRow = null, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, JsonSerializerOptions jsonOptions = null, CancellationToken ct = null) #
Returns: String

Reads an Excel table and returns JSON as an array of objects.

Parameters

tableName System.String requiredposition: 0
headersInFirstRow System.Nullable{System.Boolean} = null optionalposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
jsonOptions System.Text.Json.JsonSerializerOptions = null optionalposition: 4
ct System.Threading.CancellationToken = null optionalposition: 5
ToCsv 2 overloads
public String ToCsv(String a1Range, Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

Reads an A1 range and returns CSV text.

Parameters

a1Range System.String requiredposition: 0
headersInFirstRow System.Boolean = true optionalposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
ct System.Threading.CancellationToken = null optionalposition: 4
public String ToCsv(Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: String

Reads the worksheet used range and returns CSV text.

Parameters

headersInFirstRow System.Boolean = true optionalposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 2
ct System.Threading.CancellationToken = null optionalposition: 3
ToDataTable 2 overloads
public DataTable ToDataTable(Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: DataTable

Reads the worksheet used range as a DataTable.

Parameters

headersInFirstRow System.Boolean = true optionalposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 2
ct System.Threading.CancellationToken = null optionalposition: 3
public DataTable ToDataTable(String a1Range, Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #
Returns: DataTable

Reads an A1 range as a DataTable.

Parameters

a1Range System.String requiredposition: 0
headersInFirstRow System.Boolean = true optionalposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
ct System.Threading.CancellationToken = null optionalposition: 4
ToJson 2 overloads
public String ToJson(String a1Range, Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, JsonSerializerOptions jsonOptions = null, CancellationToken ct = null) #
Returns: String

Reads an A1 range and returns JSON as an array of objects.

Parameters

a1Range System.String requiredposition: 0
headersInFirstRow System.Boolean = true optionalposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 3
jsonOptions System.Text.Json.JsonSerializerOptions = null optionalposition: 4
ct System.Threading.CancellationToken = null optionalposition: 5
public String ToJson(Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, JsonSerializerOptions jsonOptions = null, CancellationToken ct = null) #
Returns: String

Reads the worksheet used range and returns JSON as an array of objects.

Parameters

headersInFirstRow System.Boolean = true optionalposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null optionalposition: 2
jsonOptions System.Text.Json.JsonSerializerOptions = null optionalposition: 3
ct System.Threading.CancellationToken = null optionalposition: 4
public Boolean TryGetCachedFormulaValue(Int32 row, Int32 column, out String value) #
Returns: Boolean

Tries to return a formula cell's cached value.

Parameters

row System.Int32 requiredposition: 0
column System.Int32 requiredposition: 1
value System.String@ requiredposition: 2
public Boolean TryGetCellText(Int32 row, Int32 column, out String text) #
Returns: Boolean

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 System.Int32 requiredposition: 0
The 1-based row index of the cell to inspect.
column System.Int32 requiredposition: 1
The 1-based column index of the cell to inspect.
text System.String@ requiredposition: 2
When this method returns, contains the extracted cell text if successful; otherwise, an empty string.

Returns

true if text was read successfully; otherwise, false.

public Boolean TryGetColumnIndexByHeader(String header, out Int32 columnIndex, ExcelReadOptions options = null) #
Returns: Boolean

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

Parameters

header System.String requiredposition: 0
columnIndex System.Int32@ requiredposition: 1
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 2
public Boolean TryLinkByHeaderToInternalSheets(String header, Int32 rowFrom = 2, Int32 rowTo = -1, Func<String, String> destinationSheetForCellText = null, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #
Returns: Boolean

Non-throwing variant of Boolean). Returns false when the header cannot be found or inputs are invalid.

Parameters

header System.String requiredposition: 0
rowFrom System.Int32 = 2 optionalposition: 1
rowTo System.Int32 = -1 optionalposition: 2
destinationSheetForCellText System.Func{System.String,System.String} = null optionalposition: 3
targetA1 System.String = "A1" optionalposition: 4
display System.Func{System.String,System.String} = null optionalposition: 5
styled System.Boolean = true optionalposition: 6
public Boolean TryLinkByHeaderToInternalSheetsInRange(String rangeA1, String header, String targetA1 = "A1", Func<String, String> destinationSheetForCellText = null, Func<String, String> display = null, Boolean styled = true) #
Returns: Boolean

Non-throwing variant of Boolean). Returns false when the range cannot be parsed or the header is missing.

Parameters

rangeA1 System.String requiredposition: 0
header System.String requiredposition: 1
targetA1 System.String = "A1" optionalposition: 2
destinationSheetForCellText System.Func{System.String,System.String} = null optionalposition: 3
display System.Func{System.String,System.String} = null optionalposition: 4
styled System.Boolean = true optionalposition: 5
public Boolean TryLinkByHeaderToInternalSheetsInTable(String tableName, String header, Func<String, String> destinationSheetForCellText = null, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #
Returns: Boolean

Non-throwing variant of Boolean). Returns false when the table or header cannot be found.

Parameters

tableName System.String requiredposition: 0
header System.String requiredposition: 1
destinationSheetForCellText System.Func{System.String,System.String} = null optionalposition: 2
targetA1 System.String = "A1" optionalposition: 3
display System.Func{System.String,System.String} = null optionalposition: 4
styled System.Boolean = true optionalposition: 5
public Boolean TryLinkByHeaderToUrls(String header, Int32 rowFrom = 2, Int32 rowTo = -1, Func<String, String> urlForCellText = null, Func<String, String> titleForCellText = null, Boolean styled = true) #
Returns: Boolean

Non-throwing variant of Boolean). Returns false when the header cannot be found or inputs are invalid.

Parameters

header System.String requiredposition: 0
rowFrom System.Int32 = 2 optionalposition: 1
rowTo System.Int32 = -1 optionalposition: 2
urlForCellText System.Func{System.String,System.String} = null optionalposition: 3
titleForCellText System.Func{System.String,System.String} = null optionalposition: 4
styled System.Boolean = true optionalposition: 5
public Boolean TryLinkByHeaderToUrlsInRange(String rangeA1, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #
Returns: Boolean

Non-throwing variant of Boolean). Returns false when the range cannot be parsed or the header is missing.

Parameters

rangeA1 System.String requiredposition: 0
header System.String requiredposition: 1
urlForCellText System.Func{System.String,System.String} requiredposition: 2
titleForCellText System.Func{System.String,System.String} = null optionalposition: 3
styled System.Boolean = true optionalposition: 4
public Boolean TryLinkByHeaderToUrlsInTable(String tableName, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #
Returns: Boolean

Non-throwing variant of Boolean). Returns false when the table or header cannot be found.

Parameters

tableName System.String requiredposition: 0
header System.String requiredposition: 1
urlForCellText System.Func{System.String,System.String} requiredposition: 2
titleForCellText System.Func{System.String,System.String} = null optionalposition: 3
styled System.Boolean = true optionalposition: 4
public Void UnmergeRange(String a1Range) #
Returns: Void

Removes merge definitions that overlap the supplied A1 range.

Parameters

a1Range System.String requiredposition: 0
public Void Unprotect() #
Returns: Void

Removes worksheet protection.

public Int32 UpdateComments(ExcelCommentFilter filter, String text, String author = null, String initials = null) #
Returns: Int32

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

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter requiredposition: 0
Author, text, and/or A1 range filter used to choose comments.
text System.String requiredposition: 1
Replacement comment text.
author System.String = null optionalposition: 2
Optional replacement author.
initials System.String = null optionalposition: 3
Optional replacement author initials.

Returns

Number of comments updated.

public Int32 UpdateCommentsRichText(ExcelCommentFilter filter, IEnumerable<ExcelRichTextRun> runs, String author = null, String initials = null) #
Returns: Int32

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

Parameters

filter OfficeIMO.Excel.ExcelCommentFilter requiredposition: 0
Author, text, and/or A1 range filter used to choose comments.
runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun} requiredposition: 1
Replacement rich text runs.
author System.String = null optionalposition: 2
Optional replacement author.
initials System.String = null optionalposition: 3
Optional replacement author initials.

Returns

Number of comments updated.

UpdateSheetDimension() #

Updates the SheetDimension element to reflect the current used range. Helps avoid rare "dimension" repair messages in Excel when generating sheets programmatically.

public Void ValidationCustomFormula(String a1Range, String formula, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #
Returns: Void

Applies a custom formula validation to the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
formula System.String requiredposition: 1
allowBlank System.Boolean = true optionalposition: 2
errorTitle System.String = null optionalposition: 3
errorMessage System.String = null optionalposition: 4
public Void ValidationDate(String a1Range, DataValidationOperatorValues operator, DateTime formula1, Nullable<DateTime> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #
Returns: Void

Applies a date validation to the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues requiredposition: 1
formula1 System.DateTime requiredposition: 2
formula2 System.Nullable{System.DateTime} = null optionalposition: 3
allowBlank System.Boolean = true optionalposition: 4
errorTitle System.String = null optionalposition: 5
errorMessage System.String = null optionalposition: 6
public Void ValidationDecimal(String a1Range, DataValidationOperatorValues operator, Double formula1, Nullable<Double> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #
Returns: Void

Applies a decimal number validation to the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues requiredposition: 1
formula1 System.Double requiredposition: 2
formula2 System.Nullable{System.Double} = null optionalposition: 3
allowBlank System.Boolean = true optionalposition: 4
errorTitle System.String = null optionalposition: 5
errorMessage System.String = null optionalposition: 6
public Void ValidationList(String a1Range, IEnumerable<String> items, Boolean allowBlank = true) #
Returns: Void

Applies a list validation to the specified A1 range using explicit items.

Parameters

a1Range System.String requiredposition: 0
items System.Collections.Generic.IEnumerable{System.String} requiredposition: 1
allowBlank System.Boolean = true optionalposition: 2
public Void ValidationListNamedRange(String a1Range, String namedRange, Boolean allowBlank = true) #
Returns: Void

Applies a list validation to the specified A1 range using a workbook or sheet-local named range.

Parameters

a1Range System.String requiredposition: 0
namedRange System.String requiredposition: 1
allowBlank System.Boolean = true optionalposition: 2
public Void ValidationListRange(String a1Range, String sourceA1Range, String sourceSheetName = null, Boolean allowBlank = true) #
Returns: Void

Applies a list validation to the specified A1 range using a referenced worksheet range. When sourceSheetName is omitted, the current worksheet is used.

Parameters

a1Range System.String requiredposition: 0
sourceA1Range System.String requiredposition: 1
sourceSheetName System.String = null optionalposition: 2
allowBlank System.Boolean = true optionalposition: 3
public Void ValidationTextLength(String a1Range, DataValidationOperatorValues operator, Int32 formula1, Nullable<Int32> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #
Returns: Void

Applies a text length validation to the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues requiredposition: 1
formula1 System.Int32 requiredposition: 2
formula2 System.Nullable{System.Int32} = null optionalposition: 3
allowBlank System.Boolean = true optionalposition: 4
errorTitle System.String = null optionalposition: 5
errorMessage System.String = null optionalposition: 6
public Void ValidationTime(String a1Range, DataValidationOperatorValues operator, TimeSpan formula1, Nullable<TimeSpan> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #
Returns: Void

Applies a time validation to the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues requiredposition: 1
formula1 System.TimeSpan requiredposition: 2
formula2 System.Nullable{System.TimeSpan} = null optionalposition: 3
allowBlank System.Boolean = true optionalposition: 4
errorTitle System.String = null optionalposition: 5
errorMessage System.String = null optionalposition: 6
public Void ValidationWholeNumber(String a1Range, DataValidationOperatorValues operator, Int32 formula1, Nullable<Int32> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #
Returns: Void

Applies a whole number validation to the specified A1 range.

Parameters

a1Range System.String requiredposition: 0
operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues requiredposition: 1
formula1 System.Int32 requiredposition: 2
formula2 System.Nullable{System.Int32} = null optionalposition: 3
allowBlank System.Boolean = true optionalposition: 4
errorTitle System.String = null optionalposition: 5
errorMessage System.String = null optionalposition: 6
WrapCells 2 overloads
public Void WrapCells(Int32 fromRow, Int32 toRow, Int32 column) #
Returns: Void

Enables WrapText for every cell in a column within a given row range.

Parameters

fromRow System.Int32 requiredposition: 0
The first 1-based row index in the range.
toRow System.Int32 requiredposition: 1
The last 1-based row index in the range.
column System.Int32 requiredposition: 2
The 1-based column index whose cells should wrap.
public Void WrapCells(Int32 fromRow, Int32 toRow, Int32 column, Double targetColumnWidth) #
Returns: Void

Enables WrapText for the specified column and pins the target column width (in Excel character units). Useful when mixed with auto-fit operations so wrapped columns keep a predictable width.

Parameters

fromRow System.Int32 requiredposition: 0
The first 1-based row index in the range.
toRow System.Int32 requiredposition: 1
The last 1-based row index in the range.
column System.Int32 requiredposition: 2
The 1-based column index whose cells should wrap.
targetColumnWidth System.Double requiredposition: 3
The column width, in Excel character units, to enforce when wrapping.
public ExcelChartDataRange WriteChartData(ExcelChartData data, Int32 startRow = 1, Int32 startColumn = 1, String categoryHeader = null, Boolean includeHeaderRow = true, Boolean numericCategories = false) #
Returns: ExcelChartDataRange

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

Parameters

data OfficeIMO.Excel.ExcelChartData requiredposition: 0
startRow System.Int32 = 1 optionalposition: 1
startColumn System.Int32 = 1 optionalposition: 2
categoryHeader System.String = null optionalposition: 3
includeHeaderRow System.Boolean = true optionalposition: 4
numericCategories System.Boolean = false optionalposition: 5

Properties

public IEnumerable<ExcelChart> Charts { get; } #

Enumerates charts on the worksheet.

public String Name { get; set; } #

Gets or sets the worksheet name.

public ExecutionPolicy ExecutionOverride { get; set; } #

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

EffectiveExecution #

Gets the effective execution policy for this sheet.

public IEnumerable<ExcelImage> Images { get; } #

Enumerates worksheet images anchored in the drawing layer.

public Boolean IsProtected { get; } #

Gets whether the worksheet is protected.

public String UsedRangeA1 { get; } #

Returns the used range A1 address for this sheet. Alias property for API ergonomics.

public Boolean Hidden { get; } #

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