API Reference

Class

ExcelRange

Namespace OfficeIMO.Excel
Assembly OfficeIMO.Excel
Modifiers sealed

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

Methods

public ExcelRange ApplyAutoFilter(Dictionary<UInt32, IEnumerable<String>> filterCriteria = null) #
Returns: ExcelRange

Applies 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 optionalposition: 0
public ExcelRange Clear(ExcelClearOptions options = All) #
Returns: ExcelRange

Clears selected data and metadata from the range.

Parameters

options OfficeIMO.Excel.ExcelClearOptions = All optionalposition: 0
public ExcelRange ClearAutoFilter() #
Returns: ExcelRange

Clears the worksheet AutoFilter.

public ExcelTable CreateTable(String name, Boolean hasHeader = true, TableStyle style = TableStyleMedium2, Boolean includeAutoFilter = true) #
Returns: ExcelTable

Creates an Excel table over the range.

Parameters

name System.String requiredposition: 0
hasHeader System.Boolean = true optionalposition: 1
style OfficeIMO.Excel.TableStyle = TableStyleMedium2 optionalposition: 2
includeAutoFilter System.Boolean = true optionalposition: 3
public ExcelRangeVisualSnapshot CreateVisualSnapshot(ExcelImageExportOptions options = null) #
Returns: ExcelRangeVisualSnapshot

Creates a format-neutral visual snapshot for this range.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 0
public ExcelRange Currency(Int32 decimals = 2, CultureInfo culture = null) #
Returns: ExcelRange

Applies a currency number format.

Parameters

decimals System.Int32 = 2 optionalposition: 0
culture System.Globalization.CultureInfo = null optionalposition: 1
public ExcelRange Date(String pattern = "yyyy-mm-dd") #
Returns: ExcelRange

Applies a date number format.

Parameters

pattern System.String = "yyyy-mm-dd" optionalposition: 0
public ExcelRange DateTime(String pattern = "yyyy-mm-dd hh:mm:ss") #
Returns: ExcelRange

Applies a date/time number format.

Parameters

pattern System.String = "yyyy-mm-dd hh:mm:ss" optionalposition: 0
public ExcelRange DurationHours() #
Returns: ExcelRange

Applies an elapsed-hours duration format.

public ExcelRange Error() #
Returns: ExcelRange

Applies an error status style.

public OfficeImageExportResult ExportImage(OfficeImageExportFormat format, ExcelImageExportOptions options = null) #
Returns: OfficeImageExportResult

Exports this range as PNG or SVG.

Parameters

format OfficeIMO.Drawing.OfficeImageExportFormat requiredposition: 0
options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 1
public ExcelRange HeaderStyle() #
Returns: ExcelRange

Applies a simple report header style.

public ExcelRange Integer() #
Returns: ExcelRange

Applies a whole-number format with thousands separators.

public ExcelRange Merge() #
Returns: ExcelRange

Merges the range.

public ExcelRange MutedText() #
Returns: ExcelRange

Applies a muted text style.

public ExcelRange Number(Int32 decimals = 2) #
Returns: ExcelRange

Applies a decimal number format.

Parameters

decimals System.Int32 = 2 optionalposition: 0
public ExcelRange Percent(Int32 decimals = 0) #
Returns: ExcelRange

Applies a percent number format.

Parameters

decimals System.Int32 = 0 optionalposition: 0
SaveAsPng 2 overloads
public OfficeImageExportResult SaveAsPng(Stream stream, ExcelImageExportOptions options = null) #
Returns: OfficeImageExportResult

Saves this range as a PNG file.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 1
SaveAsPng(System.IO.Stream stream, OfficeIMO.Excel.ExcelImageExportOptions options) #

Writes this range as PNG to a stream.

Parameters

stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageExportOptions required
SaveAsPngAsync 2 overloads
public Task<OfficeImageExportResult> SaveAsPngAsync(Stream stream, ExcelImageExportOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<OfficeImageExportResult>

Asynchronously saves this range as a PNG file.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
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 required
options OfficeIMO.Excel.ExcelImageExportOptions required
cancellationToken System.Threading.CancellationToken required
SaveAsSvg 2 overloads
public OfficeImageExportResult SaveAsSvg(Stream stream, ExcelImageExportOptions options = null) #
Returns: OfficeImageExportResult

Saves this range as an SVG file.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 1
SaveAsSvg(System.IO.Stream stream, OfficeIMO.Excel.ExcelImageExportOptions options) #

Writes this range as SVG to a stream.

Parameters

stream System.IO.Stream required
options OfficeIMO.Excel.ExcelImageExportOptions required
SaveAsSvgAsync 2 overloads
public Task<OfficeImageExportResult> SaveAsSvgAsync(Stream stream, ExcelImageExportOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<OfficeImageExportResult>

Asynchronously saves this range as an SVG file.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
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 required
options OfficeIMO.Excel.ExcelImageExportOptions required
cancellationToken System.Threading.CancellationToken required
public ExcelRange SetBold(Boolean bold = true) #
Returns: ExcelRange

Sets or clears bold font style for every cell in the range.

Parameters

bold System.Boolean = true optionalposition: 0
public ExcelRange SetFillColor(String hexColor) #
Returns: ExcelRange

Applies a fill color to every cell in the range.

Parameters

hexColor System.String requiredposition: 0
public ExcelRange SetFontColor(String hexColor) #
Returns: ExcelRange

Applies a font color to every cell in the range.

Parameters

hexColor System.String requiredposition: 0
public ExcelRange SetFontName(String fontName) #
Returns: ExcelRange

Applies a font family name to every cell in the range.

Parameters

fontName System.String requiredposition: 0
public ExcelRange SetFontSize(Double fontSize) #
Returns: ExcelRange

Applies a font size in points to every cell in the range.

Parameters

fontSize System.Double requiredposition: 0
public ExcelRange SetGradientFill(String fromHexColor, String toHexColor, Double degree = 0) #
Returns: ExcelRange

Applies a two-color linear gradient fill to every cell in the range.

Parameters

fromHexColor System.String requiredposition: 0
toHexColor System.String requiredposition: 1
degree System.Double = 0 optionalposition: 2
public ExcelRange SetNumberFormat(String numberFormat) #
Returns: ExcelRange

Applies a number format to every cell in the range.

Parameters

numberFormat System.String requiredposition: 0
public ExcelRange SetShrinkToFit(Boolean shrinkToFit = true) #
Returns: ExcelRange

Sets or clears shrink-to-fit text alignment for every cell in the range.

Parameters

shrinkToFit System.Boolean = true optionalposition: 0
public ExcelRange SetTextRotation(Int32 rotation) #
Returns: ExcelRange

Sets Excel text rotation for every cell in the range.

Parameters

rotation System.Int32 requiredposition: 0
public ExcelRange SortByColumn(Int32 columnOffset, Boolean ascending = true, Boolean hasHeader = true) #
Returns: ExcelRange

Sorts the range by a 1-based column offset.

Parameters

columnOffset System.Int32 requiredposition: 0
ascending System.Boolean = true optionalposition: 1
hasHeader System.Boolean = true optionalposition: 2
public ExcelRange Success() #
Returns: ExcelRange

Applies a positive/success status style.

public ExcelRange Text() #
Returns: ExcelRange

Applies a text number format.

public ExcelRange Time() #
Returns: ExcelRange

Applies a time number format.

public ExcelRangeImageExportBuilder ToImage() #
Returns: ExcelRangeImageExportBuilder

Starts a fluent image export for this range.

public Byte[] ToPng(ExcelImageExportOptions options = null) #
Returns: Byte[]

Renders this range to dependency-free PNG bytes.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 0
public String ToSvg(ExcelImageExportOptions options = null) #
Returns: String

Renders this range to dependency-free SVG text.

Parameters

options OfficeIMO.Excel.ExcelImageExportOptions = null optionalposition: 0
public ExcelRange Unmerge() #
Returns: ExcelRange

Removes merge definitions that overlap the range.

public ExcelRange Warning() #
Returns: ExcelRange

Applies a warning status style.

Properties

public ExcelSheet Sheet { get; } #

Gets the worksheet that owns the range.

public String Address { get; } #

Gets the A1 range address.

public Int32 FirstRow { get; } #

Gets the first row in the range.

public Int32 FirstColumn { get; } #

Gets the first column in the range.

public Int32 LastRow { get; } #

Gets the last row 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.