API Reference
ExcelRange
Lightweight object model wrapper for an A1 range.
Inheritance
- Object
- ExcelRange
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
- Method ExcelRange.ApplyAutoFilter
- Method ExcelRange.Clear
- Method ExcelRange.ClearAutoFilter
- Method ExcelRange.Currency
- Method ExcelRange.Date
- Method ExcelRange.DateTime
- Method ExcelRange.DurationHours
- Method ExcelRange.Error
- Method ExcelRange.HeaderStyle
- Method ExcelRange.Integer
- Method ExcelRange.Merge
- Method ExcelRange.MutedText
- Method ExcelRange.Number
- Method ExcelRange.Percent
- Method ExcelRange.SetBold
- Method ExcelRange.SetFillColor
- Method ExcelRange.SetFontColor
- Method ExcelRange.SetFontName
- Method ExcelRange.SetFontSize
- Method ExcelRange.SetGradientFill
- Method ExcelRange.SetNumberFormat
- Method ExcelRange.SetShrinkToFit
- Method ExcelRange.SetTextRotation
- Method ExcelRange.SortByColumn
- Method ExcelRange.Success
- Method ExcelRange.Text
- Method ExcelRange.Time
- Method ExcelRange.Unmerge
- Method ExcelRange.Warning
- Method ExcelRangeConditionalFormattingBuilder.AboveAverage
- Method ExcelRangeConditionalFormattingBuilder.AboveAverage
- Method ExcelRangeConditionalFormattingBuilder.BeginsWith
- Method ExcelRangeConditionalFormattingBuilder.BeginsWithText
- Method ExcelRangeConditionalFormattingBuilder.BeginsWithText
- Method ExcelRangeConditionalFormattingBuilder.BelowAverage
- Method ExcelRangeConditionalFormattingBuilder.BelowAverage
- Method ExcelRangeConditionalFormattingBuilder.Between
- Method ExcelRangeConditionalFormattingBuilder.Between
- Method ExcelRangeConditionalFormattingBuilder.Blanks
- Method ExcelRangeConditionalFormattingBuilder.Bottom
- Method ExcelRangeConditionalFormattingBuilder.Bottom
- Method ExcelRangeConditionalFormattingBuilder.CellIs
- Method ExcelRangeConditionalFormattingBuilder.CellIs
- Method ExcelRangeConditionalFormattingBuilder.CellIs
- Method ExcelRangeConditionalFormattingBuilder.Clear
- Method ExcelRangeConditionalFormattingBuilder.ColorScale
- Method ExcelRangeConditionalFormattingBuilder.ColorScale
- Method ExcelRangeConditionalFormattingBuilder.ContainsText
- Method ExcelRangeConditionalFormattingBuilder.ContainsText
- Method ExcelRangeConditionalFormattingBuilder.DataBar
- Method ExcelRangeConditionalFormattingBuilder.DataBar
- Method ExcelRangeConditionalFormattingBuilder.DuplicateValues
- Method ExcelRangeConditionalFormattingBuilder.DuplicateValues
- Method ExcelRangeConditionalFormattingBuilder.EndsWith
- Method ExcelRangeConditionalFormattingBuilder.EndsWithText
- Method ExcelRangeConditionalFormattingBuilder.EndsWithText
- Method ExcelRangeConditionalFormattingBuilder.Errors
- Method ExcelRangeConditionalFormattingBuilder.Formula
- Method ExcelRangeConditionalFormattingBuilder.Formula
- Method ExcelRangeConditionalFormattingBuilder.Formula
- Method ExcelRangeConditionalFormattingBuilder.GreaterThan
- Method ExcelRangeConditionalFormattingBuilder.GreaterThan
- Method ExcelRangeConditionalFormattingBuilder.IconSet
- Method ExcelRangeConditionalFormattingBuilder.IconSet
- Method ExcelRangeConditionalFormattingBuilder.LessThan
- Method ExcelRangeConditionalFormattingBuilder.LessThan
- Method ExcelRangeConditionalFormattingBuilder.NonBlanks
- Method ExcelRangeConditionalFormattingBuilder.NonErrors
- Method ExcelRangeConditionalFormattingBuilder.NotContainsText
- Method ExcelRangeConditionalFormattingBuilder.NotContainsText
- Method ExcelRangeConditionalFormattingBuilder.TimePeriod
- Method ExcelRangeConditionalFormattingBuilder.TimePeriod
- Method ExcelRangeConditionalFormattingBuilder.Top
- Method ExcelRangeConditionalFormattingBuilder.Top
- Method ExcelRangeConditionalFormattingBuilder.UniqueValues
- Method ExcelRangeConditionalFormattingBuilder.UniqueValues
- Method ExcelRangeDataValidationBuilder.Clear
- Method ExcelRangeDataValidationBuilder.CustomFormula
- Method ExcelRangeDataValidationBuilder.Date
- Method ExcelRangeDataValidationBuilder.DateBetween
- Method ExcelRangeDataValidationBuilder.Decimal
- Method ExcelRangeDataValidationBuilder.DecimalBetween
- Method ExcelRangeDataValidationBuilder.List
- Method ExcelRangeDataValidationBuilder.List
- Method ExcelRangeDataValidationBuilder.ListNamedRange
- Method ExcelRangeDataValidationBuilder.ListRange
- Method ExcelRangeDataValidationBuilder.Messages
- Method ExcelRangeDataValidationBuilder.TextLength
- Method ExcelRangeDataValidationBuilder.Time
- Method ExcelRangeDataValidationBuilder.WholeNumber
- Method ExcelRangeDataValidationBuilder.WholeNumberBetween
- Method ExcelSheet.Range
- Method ExcelTable.AsRange
- Method ExcelTable.Column
Methods
public ExcelRange ApplyAutoFilter(Dictionary<UInt32, IEnumerable<String>> filterCriteria = null) #ExcelRangeApplies AutoFilter to the range using optional zero-based column criteria.
Parameters
- filterCriteria System.Collections.Generic.Dictionary{System.UInt32,System.Collections.Generic.IEnumerable{System.String}} = null
public ExcelRange Clear(ExcelClearOptions options = All) #ExcelRangeClears selected data and metadata from the range.
Parameters
- options OfficeIMO.Excel.ExcelClearOptions = All
public ExcelTable CreateTable(String name, Boolean hasHeader = true, TableStyle style = TableStyleMedium2, Boolean includeAutoFilter = true) #ExcelTableCreates an Excel table over the range.
Parameters
- name System.String
- hasHeader System.Boolean = true
- style OfficeIMO.Excel.TableStyle = TableStyleMedium2
- includeAutoFilter System.Boolean = true
public ExcelRangeVisualSnapshot CreateVisualSnapshot(ExcelImageExportOptions options = null) #ExcelRangeVisualSnapshotCreates a format-neutral visual snapshot for this range.
Parameters
- options OfficeIMO.Excel.ExcelImageExportOptions = null
public ExcelRange Currency(Int32 decimals = 2, CultureInfo culture = null) #ExcelRangeApplies a currency number format.
Parameters
- decimals System.Int32 = 2
- culture System.Globalization.CultureInfo = null
public ExcelRange Date(String pattern = "yyyy-mm-dd") #ExcelRangeApplies a date number format.
Parameters
- pattern System.String = "yyyy-mm-dd"
public ExcelRange DateTime(String pattern = "yyyy-mm-dd hh:mm:ss") #ExcelRangeApplies a date/time number format.
Parameters
- pattern System.String = "yyyy-mm-dd hh:mm:ss"
public OfficeImageExportResult ExportImage(OfficeImageExportFormat format, ExcelImageExportOptions options = null) #OfficeImageExportResultExports this range as PNG or SVG.
Parameters
- format OfficeIMO.Drawing.OfficeImageExportFormat
- options OfficeIMO.Excel.ExcelImageExportOptions = null
public ExcelRange Integer() #ExcelRangeApplies a whole-number format with thousands separators.
public ExcelRange Number(Int32 decimals = 2) #ExcelRangeApplies a decimal number format.
Parameters
- decimals System.Int32 = 2
public ExcelRange Percent(Int32 decimals = 0) #ExcelRangeApplies a percent number format.
Parameters
- decimals System.Int32 = 0
public OfficeImageExportResult SaveAsPng(Stream stream, ExcelImageExportOptions options = null) #OfficeImageExportResultSaves this range as a PNG file.
Parameters
- path System.String
- options OfficeIMO.Excel.ExcelImageExportOptions = null
SaveAsPng(System.IO.Stream stream, OfficeIMO.Excel.ExcelImageExportOptions options) #Writes this range as PNG to a stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Excel.ExcelImageExportOptions
public Task<OfficeImageExportResult> SaveAsPngAsync(Stream stream, ExcelImageExportOptions options = null, CancellationToken cancellationToken = null) #Task<OfficeImageExportResult>Asynchronously saves this range as a PNG file.
Parameters
- path System.String
- options OfficeIMO.Excel.ExcelImageExportOptions = null
- cancellationToken System.Threading.CancellationToken = null
SaveAsPngAsync(System.IO.Stream stream, OfficeIMO.Excel.ExcelImageExportOptions options, System.Threading.CancellationToken cancellationToken) #Asynchronously writes this range as PNG to a stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Excel.ExcelImageExportOptions
- cancellationToken System.Threading.CancellationToken
public OfficeImageExportResult SaveAsSvg(Stream stream, ExcelImageExportOptions options = null) #OfficeImageExportResultSaves this range as an SVG file.
Parameters
- path System.String
- options OfficeIMO.Excel.ExcelImageExportOptions = null
SaveAsSvg(System.IO.Stream stream, OfficeIMO.Excel.ExcelImageExportOptions options) #Writes this range as SVG to a stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Excel.ExcelImageExportOptions
public Task<OfficeImageExportResult> SaveAsSvgAsync(Stream stream, ExcelImageExportOptions options = null, CancellationToken cancellationToken = null) #Task<OfficeImageExportResult>Asynchronously saves this range as an SVG file.
Parameters
- path System.String
- options OfficeIMO.Excel.ExcelImageExportOptions = null
- cancellationToken System.Threading.CancellationToken = null
SaveAsSvgAsync(System.IO.Stream stream, OfficeIMO.Excel.ExcelImageExportOptions options, System.Threading.CancellationToken cancellationToken) #Asynchronously writes this range as SVG to a stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Excel.ExcelImageExportOptions
- cancellationToken System.Threading.CancellationToken
public ExcelRange SetBold(Boolean bold = true) #ExcelRangeSets or clears bold font style for every cell in the range.
Parameters
- bold System.Boolean = true
public ExcelRange SetFillColor(String hexColor) #ExcelRangeApplies a fill color to every cell in the range.
Parameters
- hexColor System.String
public ExcelRange SetFontColor(String hexColor) #ExcelRangeApplies a font color to every cell in the range.
Parameters
- hexColor System.String
public ExcelRange SetFontName(String fontName) #ExcelRangeApplies a font family name to every cell in the range.
Parameters
- fontName System.String
public ExcelRange SetFontSize(Double fontSize) #ExcelRangeApplies a font size in points to every cell in the range.
Parameters
- fontSize System.Double
public ExcelRange SetGradientFill(String fromHexColor, String toHexColor, Double degree = 0) #ExcelRangeApplies a two-color linear gradient fill to every cell in the range.
Parameters
- fromHexColor System.String
- toHexColor System.String
- degree System.Double = 0
public ExcelRange SetNumberFormat(String numberFormat) #ExcelRangeApplies a number format to every cell in the range.
Parameters
- numberFormat System.String
public ExcelRange SetShrinkToFit(Boolean shrinkToFit = true) #ExcelRangeSets or clears shrink-to-fit text alignment for every cell in the range.
Parameters
- shrinkToFit System.Boolean = true
public ExcelRange SetTextRotation(Int32 rotation) #ExcelRangeSets Excel text rotation for every cell in the range.
Parameters
- rotation System.Int32
public ExcelRange SortByColumn(Int32 columnOffset, Boolean ascending = true, Boolean hasHeader = true) #ExcelRangeSorts the range by a 1-based column offset.
Parameters
- columnOffset System.Int32
- ascending System.Boolean = true
- hasHeader System.Boolean = true
public ExcelRangeImageExportBuilder ToImage() #ExcelRangeImageExportBuilderStarts a fluent image export for this range.
public Byte[] ToPng(ExcelImageExportOptions options = null) #Byte[]Renders this range to dependency-free PNG bytes.
Parameters
- options OfficeIMO.Excel.ExcelImageExportOptions = null
public String ToSvg(ExcelImageExportOptions options = null) #StringRenders this range to dependency-free SVG text.
Parameters
- options OfficeIMO.Excel.ExcelImageExportOptions = null
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public ExcelSheet Sheet { get; } #Gets the worksheet that owns the range.
public Int32 FirstColumn { get; } #Gets the first column in the range.
public Int32 LastColumn { get; } #Gets the last column in the range.
public ExcelCell FirstCell { get; } #Gets a wrapper for the top-left cell.
public ExcelRangeDataValidationBuilder Validation { get; } #Builds data validation rules for the range.
public ExcelRangeDataValidationBuilder Validate { get; } #Builds data validation rules for the range.
public ExcelRangeConditionalFormattingBuilder ConditionalFormatting { get; } #Builds conditional formatting rules for the range.
public ExcelRangeConditionalFormattingBuilder ConditionalFormat { get; } #Builds conditional formatting rules for the range.