API Reference
ExcelSheet
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.
Returned or exposed by
- Property ExcelCell.Sheet
- Extension method ExcelDocument.GetOrCreateSheet
- Method ExcelDocument.AddWorkSheet
- Method ExcelDocument.AddWorkSheet
- Method ExcelDocument.CopyWorkSheet
- Method ExcelDocument.CopyWorkSheetFrom
- Method ExcelDocument.GetSheet
- Property ExcelDocument.Item
- Property ExcelDocument.Sheets
- Method ExcelHostExtensions.GetOrCreateSheet
- Property ExcelRange.Sheet
- Property ExcelTable.Sheet
- Method PivotTableBuilder.At
- Property SheetComposer.Sheet
- Method SparklineBuilder.At
Accepted by parameters
- Method ExcelDocument.CompareRanges
- Method ExcelDocument.CompareRanges
- Method ExcelDocument.CompareWorkSheets
- Method ExcelDocument.CompareWorksheets
- Method ExcelDocument.CompareWorksheets
- Method ExcelDocument.CompareWorkSheets
- Method ExcelDocument.CopyWorkSheet
- Method ExcelDocument.CopyWorksheet
- Method ExcelDocument.GetAllNamedRanges
- Method ExcelDocument.GetNamedRange
- Method ExcelDocument.JoinWorksheets
- Method ExcelDocument.JoinWorkSheets
- Method ExcelDocument.JoinWorksheets
- Method ExcelDocument.JoinWorkSheets
- Method ExcelDocument.MergeWorksheets
- Method ExcelDocument.MergeWorkSheets
- Method ExcelDocument.MergeWorkSheets
- Method ExcelDocument.MergeWorksheets
- Method ExcelDocument.RemoveNamedRange
- Method ExcelDocument.ReorderWorkSheet
- Method ExcelDocument.ReorderWorksheet
- Method ExcelDocument.SetNamedRange
- Method ExcelDocument.SetPrintArea
- Method ExcelDocument.SetPrintTitles
- Method ExcelDocument.TryGetDirectTabularSaveCandidateRange
- Method ExcelDocument.TryGetSheet
- Method ExcelSheet.Batch
- Method ExcelSheet.SetInternalLink
Constructors
public ExcelSheet(ExcelDocument excelDocument, SpreadsheetDocument spreadSheetDocument, Sheet sheet) #Initializes a worksheet from an existing Sheet element.
Parameters
- excelDocument OfficeIMO.Excel.ExcelDocument
- Parent document.
- spreadSheetDocument DocumentFormat.OpenXml.Packaging.SpreadsheetDocument
- Open XML spreadsheet document.
- sheet DocumentFormat.OpenXml.Spreadsheet.Sheet
- 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
- Parent document.
- workbookpart DocumentFormat.OpenXml.Packaging.WorkbookPart
- Workbook part to add the worksheet to.
- spreadSheetDocument DocumentFormat.OpenXml.Packaging.SpreadsheetDocument
- Open XML spreadsheet document.
- name System.String
- Worksheet name.
Methods
public Void AddAutoFilter(String range, Dictionary<UInt32, IEnumerable<String>> filterCriteria = null) #VoidAdds an AutoFilter to the worksheet or table.
Parameters
- range System.String
- The cell range to apply the filter to.
- filterCriteria System.Collections.Generic.Dictionary{System.UInt32,System.Collections.Generic.IEnumerable{System.String}} = null
- Optional filter criteria to apply.
public ExcelChart AddBubbleChartFromRanges(IEnumerable<ExcelChartSeriesRange> seriesRanges, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, String title = null) #ExcelChartAdds a bubble chart using explicit X/Y/size ranges.
Parameters
- seriesRanges System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelChartSeriesRange}
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- title System.String = null
public ExcelChart AddChart(ExcelChartData data, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, String title = null) #ExcelChartAdds a chart to the worksheet using the provided data. Data is stored on a hidden chart data sheet.
Parameters
- data OfficeIMO.Excel.ExcelChartData
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- type OfficeIMO.Excel.ExcelChartType = ColumnClustered
- title System.String = null
public ExcelChart AddChart(ExcelChartDataRange dataRange, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, ExcelChartData cachedData = null, String title = null) #ExcelChartAdds a chart to the worksheet using an existing data range.
Parameters
- dataRange OfficeIMO.Excel.ExcelChartDataRange
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- type OfficeIMO.Excel.ExcelChartType = ColumnClustered
- cachedData OfficeIMO.Excel.ExcelChartData = null
- title System.String = null
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) #ExcelChartAdds a chart using an A1 range on this sheet.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- type OfficeIMO.Excel.ExcelChartType = ColumnClustered
- hasHeaders System.Boolean = true
- title System.String = null
- includeCachedData System.Boolean = true
public ExcelChart AddChartFromTable(String tableName, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, ExcelChartType type = ColumnClustered, String title = null, Boolean includeCachedData = true) #ExcelChartAdds a chart from a table name on this sheet.
Parameters
- tableName System.String
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- type OfficeIMO.Excel.ExcelChartType = ColumnClustered
- title System.String = null
- includeCachedData System.Boolean = true
public Void AddConditionalColorScale(String range, OfficeColor startColor, OfficeColor endColor) #VoidAdds a two-color scale conditional format to a range.
Parameters
- range System.String
- A1-style range to format.
- startColor OfficeIMO.Drawing.OfficeColor
- Starting color of the scale.
- endColor OfficeIMO.Drawing.OfficeColor
- Ending color of the scale.
public Void AddConditionalColorScale(String range, String startColor, String endColor) #VoidAdds a two-color scale conditional format to a range using hex colors.
Parameters
- range System.String
- A1-style range to format.
- startColor System.String
- Starting color in hex (e.g. FF0000).
- endColor System.String
- Ending color in hex.
public Void AddConditionalDataBar(String range, OfficeColor color) #VoidAdds a data bar conditional format to a range.
Parameters
- range System.String
- A1-style range to format.
- color OfficeIMO.Drawing.OfficeColor
- Bar color.
public Void AddConditionalDataBar(String range, String color) #VoidAdds a data bar conditional format to a range using a hex color.
Parameters
- range System.String
- A1-style range to format.
- color System.String
- Bar color in hex (e.g. FF0000).
public Void AddConditionalDuplicateValuesRule(String range) #VoidAdds a duplicate-values conditional formatting rule.
Parameters
- range System.String
public Void AddConditionalFormulaRule(String range, String formula, Boolean stopIfTrue = false) #VoidAdds a formula-based conditional formatting rule.
Parameters
- range System.String
- formula System.String
- stopIfTrue System.Boolean = false
public Void AddConditionalIconSet(String range, IconSetValues iconSet, Boolean showValue, Boolean reverseIconOrder) #VoidAdds an icon set conditional format to a range.
Parameters
- range System.String
- A1-style range to format.
- iconSet DocumentFormat.OpenXml.Spreadsheet.IconSetValues
- Icon set type (e.g., ThreeTrafficLights1, ThreeSymbols, FourArrows, FiveRatings).
- showValue System.Boolean
- Whether to display the underlying cell values.
- reverseIconOrder System.Boolean
- Reverse icon order.
public Void AddConditionalIconSet(String range, IconSetValues iconSet, Boolean showValue, Boolean reverseIconOrder, Double[] percentThresholds, Double[] numberThresholds) #VoidAdds 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
- iconSet DocumentFormat.OpenXml.Spreadsheet.IconSetValues
- showValue System.Boolean
- reverseIconOrder System.Boolean
- percentThresholds System.Double[]
- numberThresholds System.Double[]
public Void AddConditionalIconSet(String range) #VoidOverload with common defaults for convenience.
Parameters
- range System.String
public Void AddConditionalRule(String range, ConditionalFormattingOperatorValues operator, String formula1, String formula2 = null) #VoidAdds a conditional formatting rule to the specified range.
Parameters
- range System.String
- A1-style range to apply the rule to.
- operator DocumentFormat.OpenXml.Spreadsheet.ConditionalFormattingOperatorValues
- Comparison operator for the rule.
- formula1 System.String
- Primary formula or value.
- formula2 System.String = null
- Optional secondary formula or value.
public Void AddConditionalTopBottomRule(String range, UInt32 rank, Boolean bottom = false, Boolean percent = false) #VoidAdds a top/bottom conditional formatting rule.
Parameters
- range System.String
- rank System.UInt32
- bottom System.Boolean = false
- percent System.Boolean = false
public ExcelChart AddContributionChart(String dataRangeA1, Int32 row, Int32 column, String title = "Contribution", Int32 widthPixels = 520, Int32 heightPixels = 320, Boolean hasHeaders = true, Boolean includeCachedData = true) #ExcelChartAdds a doughnut chart with category/percent labels for contribution and mix analysis.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "Contribution"
- widthPixels System.Int32 = 520
- heightPixels System.Int32 = 320
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
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) #ExcelImageAdds an image anchored to the specified cell and returns a wrapper for setting metadata and sizing.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- imageBytes System.Byte[]
- Image bytes.
- contentType System.String = "image/png"
- Content type, e.g. image/png or image/jpeg.
- widthPixels System.Int32 = 96
- Width in pixels.
- heightPixels System.Int32 = 32
- Height in pixels.
- offsetXPixels System.Int32 = 0
- Optional X offset from cell origin in pixels.
- offsetYPixels System.Int32 = 0
- Optional Y offset from cell origin in pixels.
- name System.String = null
- Optional drawing name.
- altText System.String = null
- Optional alternative text description.
- lockAspectRatio System.Boolean = true
- 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) #VoidAdds 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
- 1-based row index.
- column System.Int32
- 1-based column index.
- imageBytes System.Byte[]
- Image bytes.
- contentType System.String = "image/png"
- Content type, e.g. image/png or image/jpeg.
- widthPixels System.Int32 = 96
- Width in pixels.
- heightPixels System.Int32 = 32
- Height in pixels.
- offsetXPixels System.Int32 = 0
- Optional X offset from cell origin in pixels.
- offsetYPixels System.Int32 = 0
- 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) #ExcelImageDownloads 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
- column System.Int32
- url System.String
- widthPixels System.Int32 = 96
- heightPixels System.Int32 = 32
- offsetXPixels System.Int32 = 0
- offsetYPixels System.Int32 = 0
- name System.String = null
- altText System.String = null
- lockAspectRatio System.Boolean = true
public Void AddImageFromUrlAt(Int32 row, Int32 column, String url, Int32 widthPixels = 96, Int32 heightPixels = 32, Int32 offsetXPixels = 0, Int32 offsetYPixels = 0) #VoidDownloads an image from URL (with timeout and size limits) and anchors it to the specified cell.
Parameters
- row System.Int32
- 1-based row index where the top edge of the image will be anchored.
- column System.Int32
- 1-based column index where the left edge of the image will be anchored.
- url System.String
- Remote image URL to download. Requests timeout after 5 seconds and must be smaller than 2 MB.
- widthPixels System.Int32 = 96
- Desired image width in pixels. Defaults to 96 px, converted to English Metric Units (EMUs) for OpenXML positioning.
- heightPixels System.Int32 = 32
- Desired image height in pixels. Defaults to 32 px, converted to EMUs.
- offsetXPixels System.Int32 = 0
- 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
- 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) #ExcelChartAdds a compact column chart with value callouts and dashboard-friendly defaults for KPI scorecards.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "KPI Scorecard"
- widthPixels System.Int32 = 520
- heightPixels System.Int32 = 300
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
public Void AddManualColumnPageBreak(Int32 column, Boolean save = true) #VoidAdds a manual worksheet column page break after the specified one-based column.
Parameters
- column System.Int32
- save System.Boolean = true
public Void AddManualRowPageBreak(Int32 row, Boolean save = true) #VoidAdds a manual worksheet row page break after the specified one-based row.
Parameters
- row System.Int32
- save System.Boolean = true
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) #ExcelChartAdds a chart using an A1 range and marks it as sourced from an existing pivot table.
Parameters
- pivotTableName System.String
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- type OfficeIMO.Excel.ExcelChartType = ColumnClustered
- hasHeaders System.Boolean = true
- title System.String = null
- includeCachedData System.Boolean = true
- formatId System.UInt32 = 0
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) #VoidAdds a basic pivot table based on a source range and places it at a destination cell.
Parameters
- sourceRange System.String
- Source data range (including header row), e.g. "A1:D100".
- destinationCell System.String
- Top-left cell for the pivot table (e.g. "F2").
- name System.String
- Optional pivot table name. Defaults to "PivotTable1" style.
- rowFields System.Collections.Generic.IEnumerable{System.String}
- Optional row fields (header names).
- columnFields System.Collections.Generic.IEnumerable{System.String}
- Optional column fields (header names).
- pageFields System.Collections.Generic.IEnumerable{System.String}
- Optional page fields (header names) used as filters.
- dataFields System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotDataField}
- Optional data field definitions. Defaults to last column with Sum.
- showRowGrandTotals System.Boolean
- Show row grand totals.
- showColumnGrandTotals System.Boolean
- Show column grand totals.
- pivotStyleName System.String
- Optional pivot table style name.
- layout OfficeIMO.Excel.ExcelPivotLayout
- Layout mode (Compact, Outline, Tabular).
- dataOnRows System.Nullable{System.Boolean}
- Whether to show data fields on rows instead of columns.
- showHeaders System.Nullable{System.Boolean}
- Whether to show field headers.
- showEmptyRows System.Nullable{System.Boolean}
- Whether to show empty rows.
- showEmptyColumns System.Nullable{System.Boolean}
- Whether to show empty columns.
- showDrill System.Nullable{System.Boolean}
- 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) #VoidAdds a basic pivot table based on a source range and places it at a destination cell.
Parameters
- sourceRange System.String
- Source data range (including header row), e.g. "A1:D100".
- destinationCell System.String
- Top-left cell for the pivot table (e.g. "F2").
- name System.String = null
- Optional pivot table name. Defaults to "PivotTable1" style.
- rowFields System.Collections.Generic.IEnumerable{System.String} = null
- Optional row fields (header names).
- columnFields System.Collections.Generic.IEnumerable{System.String} = null
- Optional column fields (header names).
- pageFields System.Collections.Generic.IEnumerable{System.String} = null
- Optional page fields (header names) used as filters.
- dataFields System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotDataField} = null
- Optional data field definitions. Defaults to last column with Sum.
- showRowGrandTotals System.Boolean = true
- Show row grand totals.
- showColumnGrandTotals System.Boolean = true
- Show column grand totals.
- pivotStyleName System.String = null
- Optional pivot table style name.
- layout OfficeIMO.Excel.ExcelPivotLayout = Compact
- Layout mode (Compact, Outline, Tabular).
- dataOnRows System.Nullable{System.Boolean} = null
- Whether to show data fields on rows instead of columns.
- showHeaders System.Nullable{System.Boolean} = null
- Whether to show field headers.
- showEmptyRows System.Nullable{System.Boolean} = null
- Whether to show empty rows.
- showEmptyColumns System.Nullable{System.Boolean} = null
- Whether to show empty columns.
- showDrill System.Nullable{System.Boolean} = null
- Whether to show drill indicators.
- fieldOptions System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotFieldOptions} = null
- Optional formatting and display options for source fields.
- rowHeaderCaption System.String = null
- Optional row header caption.
- columnHeaderCaption System.String = null
- Optional column header caption.
- grandTotalCaption System.String = null
- Optional grand total caption.
- missingCaption System.String = null
- Optional caption for missing values.
- errorCaption System.String = null
- Optional caption for error values.
- showDataDropDown System.Nullable{System.Boolean} = null
- Whether to show the data drop-down.
- showDropZones System.Nullable{System.Boolean} = null
- Whether to show drop zones.
- showDataTips System.Nullable{System.Boolean} = null
- Whether to show data tips.
- showMemberPropertyTips System.Nullable{System.Boolean} = null
- Whether to show member property tips.
- fieldListSortAscending System.Nullable{System.Boolean} = null
- Whether field list sorting is ascending.
- customListSort System.Nullable{System.Boolean} = null
- Whether custom-list sorting is enabled.
- pivotFilters System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotFilter} = null
- Optional label and value filters.
- calculatedFields System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotCalculatedField} = null
- Optional formula-backed pivot cache fields.
- groupings System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelPivotGrouping} = null
- 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) #ExcelChartAdds a line chart with dashboard-friendly defaults for time-series revenue or volume trends.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "Revenue Trend"
- widthPixels System.Int32 = 720
- heightPixels System.Int32 = 320
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
public ExcelChart AddScatterChartFromRanges(IEnumerable<ExcelChartSeriesRange> seriesRanges, Int32 row, Int32 column, Int32 widthPixels = 640, Int32 heightPixels = 360, String title = null) #ExcelChartAdds a scatter chart using explicit X/Y ranges.
Parameters
- seriesRanges System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelChartSeriesRange}
- row System.Int32
- column System.Int32
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- title System.String = null
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) #VoidAdds sparklines to the worksheet.
Parameters
- dataRange System.String
- A1 range containing the data (e.g., "B2:M2").
- locationRange System.String
- A1 range where sparklines will be placed (e.g., "N2:N2").
- type DocumentFormat.OpenXml.Office2010.Excel.SparklineTypeValues
- Sparkline type.
- displayMarkers System.Boolean = false
- Show markers for each data point.
- displayHighLow System.Boolean = false
- Show high/low markers.
- displayFirstLast System.Boolean = false
- Show first/last markers.
- displayNegative System.Boolean = false
- Show negative markers.
- displayAxis System.Boolean = false
- Show axis.
- seriesColor System.String = null
- Sparkline series color (#RRGGBB or #AARRGGBB).
- axisColor System.String = null
- Axis color (#RRGGBB or #AARRGGBB).
- negativeColor System.String = null
- Negative point color (#RRGGBB or #AARRGGBB).
- markersColor System.String = null
- Markers color (#RRGGBB or #AARRGGBB).
- highColor System.String = null
- High point color (#RRGGBB or #AARRGGBB).
- lowColor System.String = null
- Low point color (#RRGGBB or #AARRGGBB).
- firstColor System.String = null
- First point color (#RRGGBB or #AARRGGBB).
- lastColor System.String = null
- 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) #VoidAdds line sparklines to the worksheet.
Parameters
- dataRange System.String
- A1 range containing the data (e.g., "B2:M2").
- locationRange System.String
- A1 range where sparklines will be placed (e.g., "N2:N2").
- displayMarkers System.Boolean = false
- Show markers for each data point.
- displayHighLow System.Boolean = false
- Show high/low markers.
- displayFirstLast System.Boolean = false
- Show first/last markers.
- displayNegative System.Boolean = false
- Show negative markers.
- displayAxis System.Boolean = false
- Show axis.
- seriesColor System.String = null
- Sparkline series color (#RRGGBB or #AARRGGBB).
- axisColor System.String = null
- Axis color (#RRGGBB or #AARRGGBB).
- negativeColor System.String = null
- Negative point color (#RRGGBB or #AARRGGBB).
- markersColor System.String = null
- Markers color (#RRGGBB or #AARRGGBB).
- highColor System.String = null
- High point color (#RRGGBB or #AARRGGBB).
- lowColor System.String = null
- Low point color (#RRGGBB or #AARRGGBB).
- firstColor System.String = null
- First point color (#RRGGBB or #AARRGGBB).
- lastColor System.String = null
- 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) #ExcelChartAdds a doughnut chart with dashboard-friendly defaults for status, category, or allocation breakdowns.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "Status Breakdown"
- widthPixels System.Int32 = 520
- heightPixels System.Int32 = 320
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
public Void AddTable(String range, Boolean hasHeader, String name, TableStyle style) #VoidAdds an Excel table to the worksheet over the specified range.
Parameters
- range System.String
- Cell range (e.g. "A1:B3") defining the table area.
- hasHeader System.Boolean
- Indicates whether the first row is a header row.
- name System.String
- Name of the table. If empty, a default name is used.
- style OfficeIMO.Excel.TableStyle
- 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) #VoidAdds an Excel table to the worksheet over the specified range with optional AutoFilter and name validation behavior.
Parameters
- range System.String
- Cell range (e.g. "A1:B3") defining the table area.
- hasHeader System.Boolean
- Indicates whether the first row is a header row.
- name System.String
- 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
- Table style to apply.
- includeAutoFilter System.Boolean
- Whether to include AutoFilter dropdowns in the table headers.
- validationMode OfficeIMO.Excel.TableNameValidationMode = Sanitize
- 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) #ExcelChartAdds a horizontal bar chart with dashboard-friendly defaults for top-N rankings.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "Top Items"
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
public ExcelChart AddVarianceColumnChart(String dataRangeA1, Int32 row, Int32 column, String title = "Variance", Int32 widthPixels = 640, Int32 heightPixels = 360, Boolean hasHeaders = true, Boolean includeCachedData = true) #ExcelChartAdds a clustered column chart with dashboard-friendly defaults for variance comparisons.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "Variance"
- widthPixels System.Int32 = 640
- heightPixels System.Int32 = 360
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
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) #ExcelChartAdds a waterfall-style stacked column chart for variance bridges prepared with helper series.
Parameters
- dataRangeA1 System.String
- row System.Int32
- column System.Int32
- title System.String = "Variance Bridge"
- widthPixels System.Int32 = 720
- heightPixels System.Int32 = 360
- hasHeaders System.Boolean = true
- includeCachedData System.Boolean = true
public String AppendDataTableToTable(DataTable dataTable, String tableName, Boolean matchColumnsByHeader = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #StringAppends rows from a DataTable to an existing Excel table and expands the table range.
Parameters
- dataTable System.Data.DataTable
- Source DataTable containing rows to append.
- tableName System.String
- Existing table name or display name.
- matchColumnsByHeader System.Boolean = true
- 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
- Optional execution mode override.
- ct System.Threading.CancellationToken = null
- 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.
public Int32 ApplyTemplate(IDictionary<String, Object> values, IFormatProvider provider = null, Boolean throwOnMissing = false) #Int32Replaces {{Marker}} placeholders in text cells on this worksheet using the supplied values.
Parameters
- values System.Collections.Generic.IDictionary{System.String,System.Object}
- provider System.IFormatProvider = null
- throwOnMissing System.Boolean = false
public Int32 ApplyTemplate(Object model, ExcelTemplateOptions options) #Int32Replaces {{Marker}} placeholders in text cells on this worksheet using the supplied values and options.
Parameters
- values System.Collections.Generic.IDictionary{System.String,System.Object}
- options OfficeIMO.Excel.ExcelTemplateOptions
public Int32 ApplyTemplate(Object model, IFormatProvider provider = null, Boolean throwOnMissing = false) #Int32Replaces {{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
- provider System.IFormatProvider = null
- throwOnMissing System.Boolean = false
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
- options OfficeIMO.Excel.ExcelTemplateOptions
public Int32 ApplyTemplateOptionalRows(Int32 firstRow, Int32 rowCount, Boolean include, Object model, ExcelTemplateOptions options = null) #Int32Includes 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
- 1-based first row in the optional block.
- rowCount System.Int32
- Number of rows in the optional block.
- include System.Boolean
- True to keep and bind the block; false to remove it.
- values System.Collections.Generic.IDictionary{System.String,System.Object}
- Values used when the block is included.
- options OfficeIMO.Excel.ExcelTemplateOptions = null
- 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
- 1-based first row in the optional block.
- rowCount System.Int32
- Number of rows in the optional block.
- include System.Boolean
- True to keep and bind the block; false to remove it.
- model System.Object
- Model used when the block is included.
- options OfficeIMO.Excel.ExcelTemplateOptions
- Optional template binding options.
public Int32 ApplyTemplateRows<T>(Int32 templateRow, IEnumerable<T> rows, ExcelTemplateOptions options = null) #Int32Repeats a single template row for each supplied row value dictionary, inserting additional worksheet rows as needed.
Type Parameters
- T
Parameters
- templateRow System.Int32
- 1-based row number containing template markers.
- rows System.Collections.Generic.IEnumerable{System.Collections.Generic.IDictionary{System.String,System.Object}}
- Row value dictionaries. Each dictionary is bound to one copied row.
- options OfficeIMO.Excel.ExcelTemplateOptions = null
- 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
- 1-based row number containing template markers.
- rows System.Collections.Generic.IEnumerable{``0}
- Row models. Each model is bound to one copied row.
- options OfficeIMO.Excel.ExcelTemplateOptions
- Optional template binding options.
public Void AutoFilterAdd(String a1Range) #VoidAttaches an AutoFilter to the given A1 range (e.g., "A1:C200").
Parameters
- a1Range System.String
public Void AutoFilterByHeaderBetween(String header, Double minimumInclusive, Double maximumInclusive) #VoidApplies an AutoFilter numeric inclusive range filter to a column resolved by header within the current AutoFilter range.
Parameters
- header System.String
- minimumInclusive System.Double
- maximumInclusive System.Double
public Void AutoFilterByHeaderContains(String header, String containsText) #VoidApplies 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
- containsText System.String
public Void AutoFilterByHeaderDoesNotContain(String header, String containsText) #VoidApplies 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
- containsText System.String
public Void AutoFilterByHeaderEndsWith(String header, String endsWithText) #VoidApplies 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
- endsWithText System.String
public Void AutoFilterByHeaderEquals(String header, IEnumerable<String> values) #VoidApplies 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
- values System.Collections.Generic.IEnumerable{System.String}
public Void AutoFilterByHeaderGreaterThanOrEqual(String header, Double value) #VoidApplies an AutoFilter numeric greater-than-or-equal filter to a column resolved by header within the current AutoFilter range.
Parameters
- header System.String
- value System.Double
public Void AutoFilterByHeaderLessThanOrEqual(String header, Double value) #VoidApplies an AutoFilter numeric less-than-or-equal filter to a column resolved by header within the current AutoFilter range.
Parameters
- header System.String
- value System.Double
public Void AutoFilterByHeaderNotBetween(String header, Double minimumExclusive, Double maximumExclusive) #VoidApplies 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
- minimumExclusive System.Double
- maximumExclusive System.Double
public Void AutoFilterByHeaderNotEqual(String header, Double value) #VoidApplies an AutoFilter numeric not-equal filter to a column resolved by header within the current AutoFilter range.
Parameters
- header System.String
- value System.Double
public Void AutoFilterByHeadersEquals(params ValueTuple<String, IEnumerable<String>>[] filters) #VoidApplies 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}}[]
public Void AutoFilterByHeaderStartsWith(String header, String startsWithText) #VoidApplies 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
- startsWithText System.String
public Void AutoFitColumn(Int32 columnIndex) #VoidAuto-fits the width of the specified column based on its contents.
Parameters
- columnIndex System.Int32
- 1-based column index.
public Void AutoFitColumns(Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #VoidAutomatically fits all columns based on their content.
Parameters
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- Overrides how the auto-fit work is scheduled across columns.
- ct System.Threading.CancellationToken = null
- 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) #VoidAutomatically fits all columns except the supplied indexes.
Parameters
- columnsToSkip System.Collections.Generic.IEnumerable{System.Int32}
- 1-based column indexes that should not be resized.
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- Overrides how the auto-fit work is scheduled for the remaining columns.
- ct System.Threading.CancellationToken = null
- Cancels the auto-fit pass before it completes.
public Void AutoFitColumnsFor(IEnumerable<Int32> columnIndexes, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #VoidAutomatically fits the supplied set of column indexes.
Parameters
- columnIndexes System.Collections.Generic.IEnumerable{System.Int32}
- 1-based column indexes that should be resized to fit their content.
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- Overrides how the auto-fit work is scheduled across the selected columns.
- ct System.Threading.CancellationToken = null
- Cancels the auto-fit pass for the selected columns.
public Void AutoFitRow(Int32 rowIndex) #VoidAuto-fits the height of the specified row based on its contents.
Parameters
- rowIndex System.Int32
- 1-based row index.
public Void AutoFitRows(Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #VoidAutomatically fits all rows based on their content.
Parameters
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- Overrides how the auto-fit work is scheduled across rows.
- ct System.Threading.CancellationToken = null
- Cancels the row auto-fit pass while heights are being calculated or applied.
public Void Batch(Action<ExcelSheet> action) #VoidExecutes multiple worksheet mutations under a single workbook write lock.
Parameters
- action System.Action{OfficeIMO.Excel.ExcelSheet}
- The worksheet updates to execute.
public NoLockContext BeginNoLock() #NoLockContextBegin a no-lock context where operations bypass locking.
public Void Cell(Int32 row, Int32 column, Object value = null, String formula = null, String numberFormat = null) #VoidSets the value, formula, and number format of a cell in a single operation.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Object = null
- Optional value to assign.
- formula System.String = null
- Optional formula to apply.
- numberFormat System.String = null
- Optional number format code.
public Void CellAlign(Int32 row, Int32 column, HorizontalAlignmentValues alignment) #VoidApplies a horizontal alignment to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to align.
- column System.Int32
- The 1-based column index of the cell to align.
- alignment DocumentFormat.OpenXml.Spreadsheet.HorizontalAlignmentValues
- The horizontal alignment value to apply.
public ExcelCell CellAt(Int32 row, Int32 column) #ExcelCellReturns a lightweight object wrapper for a single cell.
Parameters
- row System.Int32
- column System.Int32
public Void CellBackground(Int32 row, Int32 column, OfficeColor color) #VoidApplies solid background to a single cell. Accepts #RRGGBB or #AARRGGBB.
Parameters
- row System.Int32
- The 1-based row index of the cell to fill.
- column System.Int32
- The 1-based column index of the cell to fill.
- hexColor System.String
- 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
- The 1-based row index of the cell to fill.
- column System.Int32
- The 1-based column index of the cell to fill.
- color OfficeIMO.Drawing.OfficeColor
- The OfficeColor to convert to a hex value.
public Void CellBold(Int32 row, Int32 column, Boolean bold = true) #VoidApplies bold font to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to modify.
- column System.Int32
- The 1-based column index of the cell to modify.
- bold System.Boolean = true
- Whether the font should be bold (true) or regular (false).
public Void CellBorder(Int32 row, Int32 column, BorderStyleValues style, String hexColor = null) #VoidApplies the same border style to all sides of a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to style.
- column System.Int32
- The 1-based column index of the cell to style.
- style DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues
- The border style to apply on all four sides.
- hexColor System.String = null
- 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) #VoidApplies diagonal border lines to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to style.
- column System.Int32
- The 1-based column index of the cell to style.
- style DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues
- The diagonal border style.
- hexColor System.String = null
- Optional border color expressed as ARGB or RGB hex.
- diagonalUp System.Boolean = true
- Whether to draw the bottom-left to top-right diagonal.
- diagonalDown System.Boolean = true
- Whether to draw the top-left to bottom-right diagonal.
public Void CellFontColor(Int32 row, Int32 column, String hexColor) #VoidApplies a font color (ARGB hex or #RRGGBB) to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to recolor.
- column System.Int32
- The 1-based column index of the cell to recolor.
- hexColor System.String
- The desired font color expressed as an ARGB or RGB hex string.
public Void CellFontName(Int32 row, Int32 column, String fontName) #VoidApplies a font family name to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to modify.
- column System.Int32
- The 1-based column index of the cell to modify.
- fontName System.String
- The font family name to assign.
public Void CellFormula(Int32 row, Int32 column, String formula) #VoidSets a formula in the specified cell.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- formula System.String
- The formula expression.
public Void CellItalic(Int32 row, Int32 column, Boolean italic = true) #VoidApplies italic font styling to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to modify.
- column System.Int32
- The 1-based column index of the cell to modify.
- italic System.Boolean = true
- Whether the font should be italic (true) or regular (false).
public Void CellUnderline(Int32 row, Int32 column, Boolean underline = true) #VoidApplies underline font styling to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to modify.
- column System.Int32
- The 1-based column index of the cell to modify.
- underline System.Boolean = true
- Whether the font should be underlined (true) or not (false).
public Void CellValue<T>(Int32 row, Int32 column, Nullable<T> value) #VoidSets the specified value into a cell, inferring the data type.
Type Parameters
- T
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Object
- The value to assign.
public Void CellValue(Int32 row, Int32 column, String value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.String
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Double value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Double
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Single value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Single
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Decimal value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Decimal
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Int32 value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Int32
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Int64 value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Int64
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Int16 value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Int16
- The value to assign.
public Void CellValue(Int32 row, Int32 column, DateTime value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.DateTime
- The value to assign.
public Void CellValue(Int32 row, Int32 column, DateTimeOffset value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.DateTimeOffset
- The value to assign.
public Void CellValue(Int32 row, Int32 column, DateOnly value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.DateOnly
- The value to assign.
public Void CellValue(Int32 row, Int32 column, TimeOnly value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.TimeOnly
- The value to assign.
public Void CellValue(Int32 row, Int32 column, TimeSpan value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.TimeSpan
- The value to assign.
public Void CellValue(Int32 row, Int32 column, UInt32 value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.UInt32
- The value to assign.
public Void CellValue(Int32 row, Int32 column, UInt64 value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.UInt64
- The value to assign.
public Void CellValue(Int32 row, Int32 column, UInt16 value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.UInt16
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Byte value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Byte
- The value to assign.
public Void CellValue(Int32 row, Int32 column, SByte value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.SByte
- The value to assign.
public Void CellValue(Int32 row, Int32 column, Boolean value) #VoidSets the specified value into a cell, inferring the data type.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Boolean
- The value to assign.
public Void CellValues(IEnumerable<ValueTuple<Int32, Int32, Object>> cells, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #VoidWrites multiple cell values efficiently, using parallelization when beneficial.
Parameters
- cells System.Collections.Generic.IEnumerable{System.ValueTuple{System.Int32,System.Int32,System.Object}}
- Collection of cell coordinates and values.
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- Optional execution mode override.
- ct System.Threading.CancellationToken = null
- Cancellation token.
public Void CellValuesParallel(IEnumerable<ValueTuple<Int32, Int32, Object>> cells) #VoidObsolete("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}}
- 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
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- value System.Nullable{``0}
- The nullable value to assign.
public Void CellVerticalAlign(Int32 row, Int32 column, VerticalAlignmentValues alignment) #VoidApplies a vertical alignment to a single cell.
Parameters
- row System.Int32
- The 1-based row index of the cell to align.
- column System.Int32
- The 1-based column index of the cell to align.
- alignment DocumentFormat.OpenXml.Spreadsheet.VerticalAlignmentValues
- The vertical alignment value to apply.
public ChartBuilder Chart(String dataRangeA1) #ChartBuilderStarts a fluent chart definition from an A1 data range.
Parameters
- dataRangeA1 System.String
public ChartBuilder ChartFromTable(String tableName) #ChartBuilderStarts a fluent chart definition from an existing table on this worksheet.
Parameters
- tableName System.String
public ExcelChartGridLayout ChartLayout(Int32 row, Int32 column, Int32 widthPixels = 520, Int32 heightPixels = 320, Int32 chartsPerRow = 2, Int32 horizontalGapPixels = 48, Int32 verticalGapRows = 2) #ExcelChartGridLayoutCreates a sequential chart layout helper for dashboard-style worksheets that use the default Excel row and column grid.
Parameters
- row System.Int32
- One-based worksheet row for the first chart.
- column System.Int32
- One-based worksheet column for the first chart.
- widthPixels System.Int32 = 520
- Default chart width in pixels.
- heightPixels System.Int32 = 320
- Default chart height in pixels.
- chartsPerRow System.Int32 = 2
- Number of charts to place before wrapping to the next row.
- horizontalGapPixels System.Int32 = 48
- Minimum horizontal gap between chart slots, in pixels, calculated against default-width Excel columns.
- verticalGapRows System.Int32 = 2
- 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) #VoidClears an array formula whose reference overlaps the supplied range or cell.
Parameters
- a1RangeOrCell System.String
public Void ClearCachedFormulaResults() #VoidRemoves cached values from formula cells on this sheet.
public Void ClearComment(Int32 row, Int32 column) #VoidRemoves a comment from the specified cell (if present).
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
public Void ClearComment(String a1) #VoidRemoves a comment from the specified A1 cell reference (if present).
Parameters
- a1 System.String
- A1 cell reference (e.g., "B5").
public Int32 ClearComments(ExcelCommentFilter filter) #Int32Removes comments that match the supplied filter.
Parameters
- filter OfficeIMO.Excel.ExcelCommentFilter
- Author, text, and/or A1 range filter used to choose comments.
Returns
Number of comments removed.
public Void ClearConditionalFormatting(String a1Range = null) #VoidClears conditional formatting rules, optionally restricted to a range.
Parameters
- a1Range System.String = null
public Void ClearRange(String a1Range, ExcelClearOptions options = All) #VoidClears selected parts of every cell and attached worksheet metadata in the range.
Parameters
- a1Range System.String
- options OfficeIMO.Excel.ExcelClearOptions = All
public Void ClearTableTotals(String tableOrRange) #VoidClears totals-row settings for the table identified by range, name, or display name.
Parameters
- tableOrRange System.String
- Table range, name, or display name.
public ColumnStyleByHeaderBuilder ColumnStyleByHeader(String header, Boolean includeHeader = false, ExcelReadOptions options = null) #ColumnStyleByHeaderBuilderReturns 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
- Header text used to resolve the target column after applying any configured normalization.
- includeHeader System.Boolean = false
- True to include the header row when styling; false to begin styling from the first data row.
- options OfficeIMO.Excel.ExcelReadOptions = null
- Read options that control header normalization and other resolution behavior.
Commit() #Persists pending changes on this worksheet to its underlying OpenXml part.
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
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
- arg2 OfficeIMO.Excel.TableNameValidationMode
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
- A short operation name used for diagnostics and policy decisions.
- itemCount System.Int32
- 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}
- Force a specific execution mode (Sequential/Parallel); null to use policy (Automatic).
- sequentialCore System.Action
- Single-threaded path. Used either when policy decides sequential or when compute/apply are not provided.
- computeParallel System.Action
- Compute phase that is safe to run without locks and must not mutate the OpenXML DOM.
- applySequential System.Action
- Apply phase that writes to the DOM. This runs once under a serialized lock.
- ct System.Threading.CancellationToken
- Cancellation token for the compute phase.
public Void FillRange(String a1Range, String hexColor) #VoidApplies a solid fill to every cell in the range.
Parameters
- a1Range System.String
- hexColor System.String
public IReadOnlyList<ExcelCommentInfo> FindComments(ExcelCommentFilter filter) #IReadOnlyList<ExcelCommentInfo>Finds legacy worksheet comments (notes) that match the supplied filter.
Parameters
- filter OfficeIMO.Excel.ExcelCommentFilter
- Optional author, text, and A1 range filter.
public String FindFirst(String text) #StringFinds 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
public Void ForEachColumn(String a1, Action<Int32> action) #VoidIterates over column indices inside an A1 range and invokes action for each column.
Parameters
- a1 System.String
- A1 range without a sheet prefix.
- action System.Action{System.Int32}
- 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) #VoidIterates over row indices inside an A1 range and invokes action for each row.
Parameters
- a1 System.String
- A1 range without a sheet prefix.
- action System.Action{System.Int32}
- 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) #VoidApplies a number format to the specified cell.
Parameters
- row System.Int32
- The 1-based row index.
- column System.Int32
- The 1-based column index.
- numberFormat System.String
- The number format code to apply.
public Void FormatRange(String a1Range, String numberFormat) #VoidApplies a number format to every cell in the range.
Parameters
- a1Range System.String
- numberFormat System.String
public Void Freeze(Int32 topRows = 0, Int32 leftCols = 0) #VoidFreezes panes on the worksheet.
Parameters
- topRows System.Int32 = 0
- Number of rows at the top to freeze.
- leftCols System.Int32 = 0
- 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) #StringInserts CSV text into the worksheet and returns the inserted range.
Parameters
- csv System.String
- startRow System.Int32 = 1
- startColumn System.Int32 = 1
- firstRowIsHeader System.Boolean = true
- includeHeaders System.Boolean = true
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public String FromJson(String json, Int32 startRow = 1, Int32 startColumn = 1, Boolean includeHeaders = true, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #StringInserts JSON array data into the worksheet and returns the inserted range.
Parameters
- json System.String
- startRow System.Int32 = 1
- startColumn System.Int32 = 1
- includeHeaders System.Boolean = true
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public IReadOnlyDictionary<String, String> GetAllNamedRanges() #IReadOnlyDictionary<String, String>Returns all defined names visible to this sheet with their A1 ranges.
public ExcelCellStyleSnapshot GetCellStyle(Int32 row, Int32 column) #ExcelCellStyleSnapshotGets a read-only snapshot of the visual style assigned to a worksheet cell.
Parameters
- row System.Int32
- column System.Int32
public ExcelChart GetChart(String name) #ExcelChartReturns a chart by name (non-visual name), or null if not found.
Parameters
- name System.String
public IReadOnlyList<ExcelColumnSnapshot> GetColumnDefinitions() #IReadOnlyList<ExcelColumnSnapshot>Gets explicit worksheet column definitions such as custom widths and hidden ranges.
public IReadOnlyList<ExcelCommentInfo> GetComments() #IReadOnlyList<ExcelCommentInfo>Gets all legacy worksheet comments (notes) on this sheet.
public IReadOnlyList<ExcelConditionalFormattingInfo> GetConditionalFormattingRules(String a1Range = null) #IReadOnlyList<ExcelConditionalFormattingInfo>Lists conditional formatting rules on the worksheet.
Parameters
- a1Range System.String = null
public IReadOnlyList<ExcelDataValidationInfo> GetDataValidations(String a1Range = null) #IReadOnlyList<ExcelDataValidationInfo>Lists data validation rules on the worksheet.
Parameters
- a1Range System.String = null
public IReadOnlyList<ExcelFormulaCellInfo> GetFormulaCells() #IReadOnlyList<ExcelFormulaCellInfo>Returns formula cells on this sheet without changing workbook contents.
public String GetFormulaText(Int32 row, Int32 column) #StringReturns the formula text from a cell, if present.
Parameters
- row System.Int32
- column System.Int32
public Dictionary<String, Int32> GetHeaderMap(ExcelReadOptions options = null) #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
public IReadOnlyDictionary<String, ExcelHyperlinkSnapshot> GetHyperlinks() #IReadOnlyDictionary<String, ExcelHyperlinkSnapshot>Gets worksheet hyperlinks keyed by their A1 cell or range reference.
Examples
sheet.SetHyperlink(2, 1, "https://example.org", display: "Example", style: true);
public ExcelImage GetImage(String name) #ExcelImageReturns an image by non-visual drawing name, or null if it was not found.
Parameters
- name System.String
public IReadOnlyList<Int32> GetManualColumnPageBreaks() #IReadOnlyList<Int32>Gets one-based worksheet columns that have a manual page break after them.
public IReadOnlyList<Int32> GetManualRowPageBreaks() #IReadOnlyList<Int32>Gets one-based worksheet rows that have a manual page break after them.
public IReadOnlyList<ExcelMergedRangeSnapshot> GetMergedRanges() #IReadOnlyList<ExcelMergedRangeSnapshot>Gets worksheet merged ranges as reusable one-based A1 metadata.
public String GetNamedRange(String name) #StringGets the A1 range for the given defined name, scoped to this sheet when applicable.
Parameters
- name System.String
- Defined name to resolve.
Returns
A1 range (e.g. "A1:B5") or null if not found.
public ExcelSheetPageSetup GetPageSetup() #ExcelSheetPageSetupReads worksheet page setup values used by print/export pipelines.
public IReadOnlyList<ExcelPivotTableInfo> GetPivotTables() #IReadOnlyList<ExcelPivotTableInfo>Returns pivot tables defined on this worksheet.
public String GetPrintArea() #StringGets the worksheet print area range, or null when no print area is configured.
public ExcelPrintTitles GetPrintTitles() #ExcelPrintTitlesGets worksheet print title rows and columns.
public ValueTuple<Int32, Int32, Int32, Int32> GetRangeBounds(String a1) #ValueTuple<Int32, Int32, Int32, Int32>Parses an A1 range and returns 1-based bounds (r1, c1, r2, c2).
Parameters
- a1 System.String
- 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) #IReadOnlyList<ExcelRichTextRun>Reads rich inline text runs from a cell.
Parameters
- row System.Int32
- column System.Int32
public IReadOnlyList<ExcelRowSnapshot> GetRowDefinitions() #IReadOnlyList<ExcelRowSnapshot>Gets explicit worksheet row definitions such as custom heights and hidden rows.
public String GetTableRange(String tableName) #StringGets the A1 range covered by a table on this worksheet.
Parameters
- tableName System.String
- Table name or display name.
Returns
The table reference, or null when no matching table exists.
public String GetUsedRangeA1() #StringReturns the used range of this worksheet as an A1 string by leveraging the read bridge.
GuessLinkDisplay(System.String arg1) #Parameters
- arg1 System.String
Examples
sheet.SetHyperlinkHost(7, 1, "https://learn.microsoft.com/office/open-xml/"); // displays "learn.microsoft.com"
public Boolean HasComment(Int32 row, Int32 column) #BooleanReturns true when a comment exists for the specified cell.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
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) #StringStreams 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
- Open data reader positioned before the first row.
- startRow System.Int32 = 1
- 1-based start row.
- startColumn System.Int32 = 1
- 1-based start column.
- includeHeaders System.Boolean = true
- Write field names as the first row.
- tableName System.String = null
- Optional Excel table name.
- style OfficeIMO.Excel.TableStyle = TableStyleMedium2
- Excel table style to use when createTable is true.
- includeAutoFilter System.Boolean = true
- Include table AutoFilter dropdowns when creating a table.
- createTable System.Boolean = true
- Create an Excel table over the imported range.
- autoFit System.Boolean = false
- Auto-fit imported columns after rows are written.
- ct System.Threading.CancellationToken = null
- 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) #VoidInserts 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
- Source DataTable.
- startRow System.Int32 = 1
- 1-based start row.
- startColumn System.Int32 = 1
- 1-based start column.
- includeHeaders System.Boolean = true
- Whether to write column headers.
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- Optional execution mode override.
- ct System.Threading.CancellationToken = null
- 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) #StringInserts 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
- startRow System.Int32 = 1
- startColumn System.Int32 = 1
- includeHeaders System.Boolean = true
- tableName System.String = null
- style OfficeIMO.Excel.TableStyle = TableStyleMedium2
- includeAutoFilter System.Boolean = true
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public Void InsertObjects<T>(IEnumerable<T> items, Boolean includeHeaders, Int32 startRow, params ValueTuple<String, Func<T, Object>>[] columns) #VoidType Parameters
- T
Parameters
- items IEnumerable<T>
- includeHeaders Boolean = true
- startRow Int32 = 1
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}
- Collection of objects to insert.
- includeHeaders System.Boolean
- Whether to include column headers.
- startRow System.Int32
- 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}
- Collection of objects to insert.
- columns System.ValueTuple{System.String,System.Func{``0,System.Object}}[]
- 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}
- Collection of objects to insert.
- includeHeaders System.Boolean
- Whether to include column headers.
- startRow System.Int32
- 1-based starting row.
- columns System.ValueTuple{System.String,System.Func{``0,System.Object}}[]
- Column headers and selectors.
public ExcelFormulaInspection InspectFormulas() #ExcelFormulaInspectionInspects formula cells on this sheet without changing workbook contents.
public ExcelTemplateInspection InspectTemplate() #ExcelTemplateInspectionInspects {{Marker}} placeholders on this worksheet without modifying it.
public ExcelTemplateInspection InspectTemplate(IDictionary<String, Object> values) #ExcelTemplateInspectionInspects {{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}
public ExcelTemplateInspection InspectTemplate(Object model) #ExcelTemplateInspectionInspects {{Marker}} placeholders on this worksheet and reports which markers are missing from public properties on the supplied model.
Parameters
- model System.Object
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) #VoidLinks 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
- Header text of the column to process.
- rowFrom System.Int32 = 2
- First data row (1-based). Defaults to 2 (skip header).
- rowTo System.Int32 = -1
- Last data row (inclusive). When <= 0, uses the bottom of the used range.
- destinationSheetForCellText System.Func{System.String,System.String} = null
- Maps cell text to a destination sheet name; defaults to identity.
- targetA1 System.String = "A1"
- Destination cell on the target sheet (default "A1").
- display System.Func{System.String,System.String} = null
- Optional display selector; defaults to the cell text.
- styled System.Boolean = true
- 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) #VoidLinks 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
- A1 range (e.g., "A1:D50"). The first row is treated as the header row.
- header System.String
- Header text to match (case-insensitive).
- destinationSheetForCellText System.Func{System.String,System.String} = null
- Maps cell text to destination sheet name (defaults to identity).
- targetA1 System.String = "A1"
- Destination cell on the target sheet (default "A1").
- display System.Func{System.String,System.String} = null
- Optional display selector; defaults to the cell text.
- styled System.Boolean = true
- 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) #VoidLinks a column within a table to internal sheets. The table range determines the row bounds.
Parameters
- tableName System.String
- Name of the table (as shown in Excel's Name Manager).
- header System.String
- Header text of the column inside the table.
- destinationSheetForCellText System.Func{System.String,System.String} = null
- Maps cell text to a destination sheet name (defaults to identity).
- targetA1 System.String = "A1"
- Destination cell on the target sheet (default "A1").
- display System.Func{System.String,System.String} = null
- Optional display selector; defaults to the cell text.
- styled System.Boolean = true
- 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) #VoidLinks 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
- Header text of the column to process.
- rowFrom System.Int32 = 2
- First data row (1-based). Defaults to 2 (skip header).
- rowTo System.Int32 = -1
- Last data row (inclusive). When <= 0, uses the bottom of the used range.
- urlForCellText System.Func{System.String,System.String} = null
- Maps cell text to URL.
- titleForCellText System.Func{System.String,System.String} = null
- Optional display selector; when null, a smart display (RFC/host) is used.
- styled System.Boolean = true
- Apply hyperlink styling (blue + underline).
public Void LinkByHeaderToUrlsInRange(String rangeA1, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #VoidLinks 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
- A1 range (e.g., "A1:D50"). The first row is treated as the header row.
- header System.String
- Header text to match (case-insensitive).
- urlForCellText System.Func{System.String,System.String}
- Maps cell text to URL.
- titleForCellText System.Func{System.String,System.String} = null
- Optional display selector; when null, a smart display (RFC/host) is used.
- styled System.Boolean = true
- Apply hyperlink styling (blue + underline).
public Void LinkByHeaderToUrlsInTable(String tableName, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #VoidLinks a column within a table to external URLs. The table range determines the row bounds.
Parameters
- tableName System.String
- Name of the table.
- header System.String
- Header text of the column inside the table.
- urlForCellText System.Func{System.String,System.String}
- Maps cell text to URL.
- titleForCellText System.Func{System.String,System.String} = null
- Optional display selector; when null, a smart display (RFC/host) is used.
- styled System.Boolean = true
- 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) #VoidConverts 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
- A1 range to process (e.g., a column of names).
- destinationSheetForCellText System.Func{System.String,System.String}
- Maps the cell text to a destination sheet name.
- targetA1 System.String = "A1"
- Destination cell on the target sheet (default "A1").
- display System.Func{System.String,System.String} = null
- Optional display text selector. Defaults to the cell text.
- styled System.Boolean = true
- 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
public Void MergeRange(String a1Range) #VoidMerges the specified A1 range.
Parameters
- a1Range System.String
public PivotTableBuilder Pivot(String sourceRange) #PivotTableBuilderStarts a fluent pivot table definition from an A1 source range.
Parameters
- sourceRange System.String
- 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) #VoidApplies worksheet protection using the provided options.
Parameters
- options OfficeIMO.Excel.ExcelSheetProtectionOptions = null
- Protection options (defaults allow selection of locked/unlocked cells).
public ExcelRange Range(String a1Range) #ExcelRangeReturns a lightweight object wrapper for an A1 range.
Parameters
- a1Range System.String
public Int32 RecalculateSupportedFormulas() #Int32Evaluates supported formulas on this sheet and writes cached results.
public Void RefreshHeaderCache(ExcelReadOptions options = null) #VoidForces rebuilding the header map for the current UsedRange and options.
Parameters
- options OfficeIMO.Excel.ExcelReadOptions = null
public Void RemoveDataValidations(String a1Range = null) #VoidRemoves data validation rules, optionally restricted to a range.
Parameters
- a1Range System.String = null
public Boolean RemoveNamedRange(String name, Boolean save = true) #BooleanRemoves a defined name scoped to this sheet.
Parameters
- name System.String
- Defined name to remove.
- save System.Boolean = true
- When true, saves the workbook after removal.
Returns
True if removed; false if not found.
public Int32 RemoveTemplateOptionalRows(Int32 firstRow, Int32 rowCount) #Int32Removes an optional worksheet row block and shifts following worksheet rows up.
Parameters
- firstRow System.Int32
- 1-based first row in the optional block.
- rowCount System.Int32
- Number of rows in the optional block.
public Int32 ReplaceAll(String oldText, String newText) #Int32Replaces all occurrences of oldText with newText in string cells. Returns the number of replacements performed.
Parameters
- oldText System.String
- newText System.String
public IEnumerable<Dictionary<String, Object>> Rows(ExcelReadOptions options = null) #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
- Optional read options/presets.
public IEnumerable<Dictionary<String, Object>> Rows(String a1Range, ExcelReadOptions options = null) #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
- Inclusive A1 range (e.g., "A1:C100").
- options OfficeIMO.Excel.ExcelReadOptions = null
- Optional read options/presets.
public IEnumerable<T> RowsAs<T>(String a1Range, ExcelReadOptions options = null) #IEnumerable<T>Type Parameters
- T
Parameters
- a1Range String
- options ExcelReadOptions = null
public IEnumerable<T> RowsAsStream<T>(String a1Range, ExcelReadOptions options = null, CancellationToken ct = null) #IEnumerable<T>Type Parameters
- T
Parameters
- a1Range String
- options ExcelReadOptions = null
- ct CancellationToken = null
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
- options OfficeIMO.Excel.ExcelReadOptions
- ct System.Threading.CancellationToken
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
- options OfficeIMO.Excel.ExcelReadOptions
public IEnumerable<RowEdit> RowsObjects(ExcelReadOptions options = null) #IEnumerable<RowEdit>Reads the sheet's used range as editable rows. First row is treated as headers.
Parameters
- options OfficeIMO.Excel.ExcelReadOptions = null
public IEnumerable<RowEdit> RowsObjects(String a1Range, ExcelReadOptions options = null) #IEnumerable<RowEdit>Reads the specified A1 range as editable rows. First row is treated as headers.
Parameters
- a1Range System.String
- options OfficeIMO.Excel.ExcelReadOptions = null
public Void SetArrayFormula(String a1Range, String formula) #VoidSets a shared-free array formula over a range. The top-left cell owns the formula metadata.
Parameters
- a1Range System.String
- formula System.String
public Void SetByHeader(Int32 rowIndex, String header, Object value, ExcelReadOptions options = null) #VoidSets 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
- header System.String
- value System.Object
- options OfficeIMO.Excel.ExcelReadOptions = null
public Void SetCellValues(IEnumerable<ValueTuple<Int32, Int32, Object>> cells, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #VoidObsolete("Use CellValues(...) instead.")Obsolete. Use CancellationToken) instead.
Parameters
- cells System.Collections.Generic.IEnumerable{System.ValueTuple{System.Int32,System.Int32,System.Object}}
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public Void SetColumnWidth(Int32 columnIndex, Double width) #VoidSets the width of the specified column.
Parameters
- columnIndex System.Int32
- 1-based column index.
- width System.Double
- The column width.
public Void SetComment(Int32 row, Int32 column, String text, String author = "OfficeIMO", String initials = null) #VoidAdds or replaces a comment on the specified cell.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- text System.String
- Comment text.
- author System.String = "OfficeIMO"
- Author name (optional).
- initials System.String = null
- Author initials (optional).
public Void SetComment(String a1, String text, String author = "OfficeIMO", String initials = null) #VoidAdds or replaces a comment on the specified A1 cell reference.
Parameters
- a1 System.String
- A1 cell reference (e.g., "B5").
- text System.String
- Comment text.
- author System.String = "OfficeIMO"
- Author name (optional).
- initials System.String = null
- Author initials (optional).
public Void SetCommentRichText(Int32 row, Int32 column, IEnumerable<ExcelRichTextRun> runs, String author = "OfficeIMO", String initials = null) #VoidAdds or replaces a rich-text comment on the specified cell.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun}
- Rich text runs that make up the comment text.
- author System.String = "OfficeIMO"
- Author name (optional).
- initials System.String = null
- Author initials (optional).
public Void SetCommentRichText(String a1, IEnumerable<ExcelRichTextRun> runs, String author = "OfficeIMO", String initials = null) #VoidAdds or replaces a rich-text comment on the specified A1 cell reference.
Parameters
- a1 System.String
- A1 cell reference (e.g., "B5").
- runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun}
- Rich text runs that make up the comment text.
- author System.String = "OfficeIMO"
- Author name (optional).
- initials System.String = null
- Author initials (optional).
public Void SetDataValidationMessages(String a1Range, ExcelDataValidationMessageOptions options) #VoidApplies prompt/error-message metadata to existing validations that overlap the range.
Parameters
- a1Range System.String
- options OfficeIMO.Excel.ExcelDataValidationMessageOptions
public Void SetGridlinesVisible(Boolean visible) #VoidShows or hides gridlines on the current sheet (view-level setting).
Parameters
- visible System.Boolean
public Void SetHyperlink(Int32 row, Int32 column, String url, String display = null, Boolean style = true) #VoidSets an external hyperlink on a single cell. If display is null or empty, the URL is shown.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- url System.String
- Target URL.
- display System.String = null
- Optional display text. When null/empty, the URL is displayed.
- style System.Boolean = true
- When true, applies hyperlink styling (blue + underline).
public Void SetHyperlink(String a1, String url, String display = null, Boolean style = true) #VoidSets an external hyperlink using an A1 reference (e.g., "B5").
Parameters
- a1 System.String
- A1 cell reference without a sheet prefix.
- url System.String
- Target URL.
- display System.String = null
- Optional display text. When null/empty, the URL is displayed.
- style System.Boolean = true
- When true, applies hyperlink styling (blue + underline).
public Void SetHyperlinkHost(Int32 row, Int32 column, String url, Boolean style = true) #VoidCreates an external hyperlink showing only the host (e.g., example.org) as display text.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- url System.String
- Target URL.
- style System.Boolean = true
- 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) #VoidCreates 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
- 1-based row index.
- column System.Int32
- 1-based column index.
- url System.String
- Target URL.
- title System.String = null
- Optional preferred display text.
- style System.Boolean = true
- When true, applies hyperlink styling (blue + underline).
Examples
// Given a summary table where column A contains sheet names, link each cell to its sheet sheet.LinkCellsToInternalSheets("A2:A51", text => text, targetA1: "A1", styled: true);
public Void SetInternalLink(Int32 row, Int32 column, String location, String display = null, Boolean style = true) #VoidSets an internal hyperlink (location in this workbook), e.g., "'Sheet1'!A1".
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- location System.String
- Target location inside the workbook (e.g., "'Summary'!A1").
- display System.String = null
- Optional display text. When null/empty, location is displayed.
- style System.Boolean = true
- When true, applies hyperlink styling (blue + underline).
Examples
sheet.SetHyperlink("B5", "https://contoso.com");
public Void SetInternalLink(Int32 row, Int32 column, ExcelSheet target, String a1, String display = null, Boolean style = true) #VoidSets an internal hyperlink to a target sheet and A1 location using safe quoting rules.
Parameters
- row System.Int32
- 1-based row index.
- column System.Int32
- 1-based column index.
- target OfficeIMO.Excel.ExcelSheet
- Target sheet.
- a1 System.String
- A1 reference on the target sheet.
- display System.String = null
- Optional display text. When null/empty, the location is displayed.
- style System.Boolean = true
- When true, applies hyperlink styling (blue + underline).
Examples
// Link A2 to the top of Summary sheet sheet.SetInternalLink(2, 1, "'Summary'!A1", display: "Summary", style: true);
public Void SetMargins(Double left, Double right, Double top, Double bottom, Double header = 0.3, Double footer = 0.3) #VoidSets page margins in inches.
Parameters
- left System.Double
- right System.Double
- top System.Double
- bottom System.Double
- header System.Double = 0.3
- footer System.Double = 0.3
public Void SetMarginsPreset(ExcelMarginPreset preset) #VoidApplies a preset set of margins.
Parameters
- preset OfficeIMO.Excel.ExcelMarginPreset
public Void SetNamedRange(String name, String range, Boolean save = true, Boolean hidden = false) #VoidCreates or updates a named range in the workbook, scoped to this sheet.
Parameters
- name System.String
- Defined name to create or update.
- range System.String
- A1 range (e.g. "A1:B5").
- save System.Boolean = true
- When true, saves the workbook after the change.
- hidden System.Boolean = false
- When true, marks the defined name as hidden.
public Void SetNamedRange(String name, String range, Boolean save, Boolean hidden, NameValidationMode validationMode) #VoidCreates or updates a named range in the workbook, scoped to this sheet, with validation control.
Parameters
- name System.String
- Defined name to create or update.
- range System.String
- A1 range (e.g. "A1:B5").
- save System.Boolean
- When true, saves the workbook after the change.
- hidden System.Boolean
- When true, marks the defined name as hidden.
- validationMode OfficeIMO.Excel.NameValidationMode
- Controls how the name and range are validated: Sanitize (default) clamps/adjusts; Strict throws on invalid input.
public Void SetOrientation(ExcelPageOrientation orientation) #VoidSets page orientation (Portrait or Landscape) on the sheet's PageSetup.
Parameters
- orientation OfficeIMO.Excel.ExcelPageOrientation
public Void SetPageSetup(Nullable<UInt32> fitToWidth = null, Nullable<UInt32> fitToHeight = null, Nullable<UInt32> scale = null) #VoidConfigures basic print/page setup for the sheet.
Parameters
- fitToWidth System.Nullable{System.UInt32} = null
- Number of pages to fit horizontally (1 = fit to one page).
- fitToHeight System.Nullable{System.UInt32} = null
- Number of pages to fit vertically (0 = unlimited).
- scale System.Nullable{System.UInt32} = null
- Manual scale (10-400). Ignored if FitToWidth/Height are specified.
public Void SetRichText(Int32 row, Int32 column, IEnumerable<ExcelRichTextRun> runs) #VoidWrites rich inline text runs into a cell.
Parameters
- row System.Int32
- column System.Int32
- runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun}
public Void SetRowHeight(Int32 rowIndex, Double height) #VoidSets the explicit height of the specified row in points. Use a non-positive height to clear the custom row height.
Parameters
- rowIndex System.Int32
- 1-based row index.
- height System.Double
- Row height in points.
public Void SetTableStyle(String tableOrRange, TableStyle style, Nullable<Boolean> showFirstColumn = null, Nullable<Boolean> showLastColumn = null, Nullable<Boolean> showRowStripes = null, Nullable<Boolean> showColumnStripes = null) #VoidUpdates the visual style flags for the table identified by range, name, or display name.
Parameters
- tableOrRange System.String
- Table range, name, or display name.
- style OfficeIMO.Excel.TableStyle
- Table style to apply.
- showFirstColumn System.Nullable{System.Boolean} = null
- Optional first-column emphasis flag.
- showLastColumn System.Nullable{System.Boolean} = null
- Optional last-column emphasis flag.
- showRowStripes System.Nullable{System.Boolean} = null
- Optional row stripe flag.
- showColumnStripes System.Nullable{System.Boolean} = null
- Optional column stripe flag.
public Void SetTableTotals(String range, Dictionary<String, TotalsRowFunctionValues> byHeader) #VoidEnables 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
- 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}
- 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) #VoidEnables a totals row for the named table and assigns per-column functions by header name.
Parameters
- tableName System.String
- Table name or display name.
- byHeader System.Collections.Generic.IDictionary{System.String,DocumentFormat.OpenXml.Spreadsheet.TotalsRowFunctionValues}
- Mapping of table header names to totals functions.
public Void SortRangeByColumn(String a1Range, Int32 columnOffset, Boolean ascending = true, Boolean hasHeader = true) #VoidSorts a rectangular range by a 1-based column offset while moving whole row cell nodes.
Parameters
- a1Range System.String
- columnOffset System.Int32
- ascending System.Boolean = true
- hasHeader System.Boolean = true
public Void SortUsedRangeByHeader(String header, Boolean ascending = true) #VoidSorts 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
- ascending System.Boolean = true
public Void SortUsedRangeByHeaders(params ValueTuple<String, Boolean>[] keys) #VoidSorts 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}[]
public SparklineBuilder Sparklines(String dataRange) #SparklineBuilderStarts a fluent sparkline definition from an A1 data range.
Parameters
- dataRange System.String
public ExcelTable Table(String nameOrRange) #ExcelTableReturns a lightweight object wrapper for a table by name, display name, or range.
Parameters
- nameOrRange System.String
public String TableToCsv(String tableName, Nullable<Boolean> headersInFirstRow = null, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #StringReads an Excel table and returns CSV text.
Parameters
- tableName System.String
- headersInFirstRow System.Nullable{System.Boolean} = null
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public DataTable TableToDataTable(String tableName, Nullable<Boolean> headersInFirstRow = null, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #DataTableReads an Excel table as a DataTable.
Parameters
- tableName System.String
- headersInFirstRow System.Nullable{System.Boolean} = null
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public String TableToJson(String tableName, Nullable<Boolean> headersInFirstRow = null, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, JsonSerializerOptions jsonOptions = null, CancellationToken ct = null) #StringReads an Excel table and returns JSON as an array of objects.
Parameters
- tableName System.String
- headersInFirstRow System.Nullable{System.Boolean} = null
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- jsonOptions System.Text.Json.JsonSerializerOptions = null
- ct System.Threading.CancellationToken = null
public String ToCsv(String a1Range, Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #StringReads an A1 range and returns CSV text.
Parameters
- a1Range System.String
- headersInFirstRow System.Boolean = true
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public String ToCsv(Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #StringReads the worksheet used range and returns CSV text.
Parameters
- headersInFirstRow System.Boolean = true
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public DataTable ToDataTable(Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #DataTableReads the worksheet used range as a DataTable.
Parameters
- headersInFirstRow System.Boolean = true
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public DataTable ToDataTable(String a1Range, Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, CancellationToken ct = null) #DataTableReads an A1 range as a DataTable.
Parameters
- a1Range System.String
- headersInFirstRow System.Boolean = true
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- ct System.Threading.CancellationToken = null
public String ToJson(String a1Range, Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, JsonSerializerOptions jsonOptions = null, CancellationToken ct = null) #StringReads an A1 range and returns JSON as an array of objects.
Parameters
- a1Range System.String
- headersInFirstRow System.Boolean = true
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- jsonOptions System.Text.Json.JsonSerializerOptions = null
- ct System.Threading.CancellationToken = null
public String ToJson(Boolean headersInFirstRow = true, ExcelReadOptions options = null, Nullable<ExecutionMode> mode = null, JsonSerializerOptions jsonOptions = null, CancellationToken ct = null) #StringReads the worksheet used range and returns JSON as an array of objects.
Parameters
- headersInFirstRow System.Boolean = true
- options OfficeIMO.Excel.ExcelReadOptions = null
- mode System.Nullable{OfficeIMO.Excel.ExecutionMode} = null
- jsonOptions System.Text.Json.JsonSerializerOptions = null
- ct System.Threading.CancellationToken = null
public Boolean TryGetCachedFormulaValue(Int32 row, Int32 column, out String value) #BooleanTries to return a formula cell's cached value.
Parameters
- row System.Int32
- column System.Int32
- value System.String@
public Boolean TryGetCellText(Int32 row, Int32 column, out String text) #BooleanTries 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
- The 1-based row index of the cell to inspect.
- column System.Int32
- The 1-based column index of the cell to inspect.
- text System.String@
- 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) #BooleanTries 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
- columnIndex System.Int32@
- options OfficeIMO.Excel.ExcelReadOptions = null
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) #BooleanNon-throwing variant of Boolean). Returns false when the header cannot be found or inputs are invalid.
Parameters
- header System.String
- rowFrom System.Int32 = 2
- rowTo System.Int32 = -1
- destinationSheetForCellText System.Func{System.String,System.String} = null
- targetA1 System.String = "A1"
- display System.Func{System.String,System.String} = null
- styled System.Boolean = true
public Boolean TryLinkByHeaderToInternalSheetsInRange(String rangeA1, String header, String targetA1 = "A1", Func<String, String> destinationSheetForCellText = null, Func<String, String> display = null, Boolean styled = true) #BooleanNon-throwing variant of Boolean). Returns false when the range cannot be parsed or the header is missing.
Parameters
- rangeA1 System.String
- header System.String
- targetA1 System.String = "A1"
- destinationSheetForCellText System.Func{System.String,System.String} = null
- display System.Func{System.String,System.String} = null
- styled System.Boolean = true
public Boolean TryLinkByHeaderToInternalSheetsInTable(String tableName, String header, Func<String, String> destinationSheetForCellText = null, String targetA1 = "A1", Func<String, String> display = null, Boolean styled = true) #BooleanNon-throwing variant of Boolean). Returns false when the table or header cannot be found.
Parameters
- tableName System.String
- header System.String
- destinationSheetForCellText System.Func{System.String,System.String} = null
- targetA1 System.String = "A1"
- display System.Func{System.String,System.String} = null
- styled System.Boolean = true
public Boolean TryLinkByHeaderToUrls(String header, Int32 rowFrom = 2, Int32 rowTo = -1, Func<String, String> urlForCellText = null, Func<String, String> titleForCellText = null, Boolean styled = true) #BooleanNon-throwing variant of Boolean). Returns false when the header cannot be found or inputs are invalid.
Parameters
- header System.String
- rowFrom System.Int32 = 2
- rowTo System.Int32 = -1
- urlForCellText System.Func{System.String,System.String} = null
- titleForCellText System.Func{System.String,System.String} = null
- styled System.Boolean = true
public Boolean TryLinkByHeaderToUrlsInRange(String rangeA1, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #BooleanNon-throwing variant of Boolean). Returns false when the range cannot be parsed or the header is missing.
Parameters
- rangeA1 System.String
- header System.String
- urlForCellText System.Func{System.String,System.String}
- titleForCellText System.Func{System.String,System.String} = null
- styled System.Boolean = true
public Boolean TryLinkByHeaderToUrlsInTable(String tableName, String header, Func<String, String> urlForCellText, Func<String, String> titleForCellText = null, Boolean styled = true) #BooleanNon-throwing variant of Boolean). Returns false when the table or header cannot be found.
Parameters
- tableName System.String
- header System.String
- urlForCellText System.Func{System.String,System.String}
- titleForCellText System.Func{System.String,System.String} = null
- styled System.Boolean = true
public Void UnmergeRange(String a1Range) #VoidRemoves merge definitions that overlap the supplied A1 range.
Parameters
- a1Range System.String
public Int32 UpdateComments(ExcelCommentFilter filter, String text, String author = null, String initials = null) #Int32Replaces the text, and optionally author, for comments that match the supplied filter.
Parameters
- filter OfficeIMO.Excel.ExcelCommentFilter
- Author, text, and/or A1 range filter used to choose comments.
- text System.String
- Replacement comment text.
- author System.String = null
- Optional replacement author.
- initials System.String = null
- Optional replacement author initials.
Returns
Number of comments updated.
public Int32 UpdateCommentsRichText(ExcelCommentFilter filter, IEnumerable<ExcelRichTextRun> runs, String author = null, String initials = null) #Int32Replaces rich text, and optionally author, for comments that match the supplied filter.
Parameters
- filter OfficeIMO.Excel.ExcelCommentFilter
- Author, text, and/or A1 range filter used to choose comments.
- runs System.Collections.Generic.IEnumerable{OfficeIMO.Excel.ExcelRichTextRun}
- Replacement rich text runs.
- author System.String = null
- Optional replacement author.
- initials System.String = null
- 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) #VoidApplies a custom formula validation to the specified A1 range.
Parameters
- a1Range System.String
- formula System.String
- allowBlank System.Boolean = true
- errorTitle System.String = null
- errorMessage System.String = null
public Void ValidationDate(String a1Range, DataValidationOperatorValues operator, DateTime formula1, Nullable<DateTime> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #VoidApplies a date validation to the specified A1 range.
Parameters
- a1Range System.String
- operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues
- formula1 System.DateTime
- formula2 System.Nullable{System.DateTime} = null
- allowBlank System.Boolean = true
- errorTitle System.String = null
- errorMessage System.String = null
public Void ValidationDecimal(String a1Range, DataValidationOperatorValues operator, Double formula1, Nullable<Double> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #VoidApplies a decimal number validation to the specified A1 range.
Parameters
- a1Range System.String
- operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues
- formula1 System.Double
- formula2 System.Nullable{System.Double} = null
- allowBlank System.Boolean = true
- errorTitle System.String = null
- errorMessage System.String = null
public Void ValidationList(String a1Range, IEnumerable<String> items, Boolean allowBlank = true) #VoidApplies a list validation to the specified A1 range using explicit items.
Parameters
- a1Range System.String
- items System.Collections.Generic.IEnumerable{System.String}
- allowBlank System.Boolean = true
public Void ValidationListNamedRange(String a1Range, String namedRange, Boolean allowBlank = true) #VoidApplies a list validation to the specified A1 range using a workbook or sheet-local named range.
Parameters
- a1Range System.String
- namedRange System.String
- allowBlank System.Boolean = true
public Void ValidationListRange(String a1Range, String sourceA1Range, String sourceSheetName = null, Boolean allowBlank = true) #VoidApplies 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
- sourceA1Range System.String
- sourceSheetName System.String = null
- allowBlank System.Boolean = true
public Void ValidationTextLength(String a1Range, DataValidationOperatorValues operator, Int32 formula1, Nullable<Int32> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #VoidApplies a text length validation to the specified A1 range.
Parameters
- a1Range System.String
- operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues
- formula1 System.Int32
- formula2 System.Nullable{System.Int32} = null
- allowBlank System.Boolean = true
- errorTitle System.String = null
- errorMessage System.String = null
public Void ValidationTime(String a1Range, DataValidationOperatorValues operator, TimeSpan formula1, Nullable<TimeSpan> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #VoidApplies a time validation to the specified A1 range.
Parameters
- a1Range System.String
- operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues
- formula1 System.TimeSpan
- formula2 System.Nullable{System.TimeSpan} = null
- allowBlank System.Boolean = true
- errorTitle System.String = null
- errorMessage System.String = null
public Void ValidationWholeNumber(String a1Range, DataValidationOperatorValues operator, Int32 formula1, Nullable<Int32> formula2 = null, Boolean allowBlank = true, String errorTitle = null, String errorMessage = null) #VoidApplies a whole number validation to the specified A1 range.
Parameters
- a1Range System.String
- operator DocumentFormat.OpenXml.Spreadsheet.DataValidationOperatorValues
- formula1 System.Int32
- formula2 System.Nullable{System.Int32} = null
- allowBlank System.Boolean = true
- errorTitle System.String = null
- errorMessage System.String = null
public Void WrapCells(Int32 fromRow, Int32 toRow, Int32 column) #VoidEnables WrapText for every cell in a column within a given row range.
Parameters
- fromRow System.Int32
- The first 1-based row index in the range.
- toRow System.Int32
- The last 1-based row index in the range.
- column System.Int32
- The 1-based column index whose cells should wrap.
public Void WrapCells(Int32 fromRow, Int32 toRow, Int32 column, Double targetColumnWidth) #VoidEnables 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
- The first 1-based row index in the range.
- toRow System.Int32
- The last 1-based row index in the range.
- column System.Int32
- The 1-based column index whose cells should wrap.
- targetColumnWidth System.Double
- 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) #ExcelChartDataRangeWrites chart data into the worksheet and returns the corresponding data range.
Parameters
- data OfficeIMO.Excel.ExcelChartData
- startRow System.Int32 = 1
- startColumn System.Int32 = 1
- categoryHeader System.String = null
- includeHeaderRow System.Boolean = true
- numericCategories System.Boolean = false
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
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.