Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeSheetSelector

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
0eef6a5756b9 with working tree changes
Modifiers
sealed

An immutable worksheet name, wildcard pattern, one-based position, or live worksheet identity.

Inheritance

  • object
  • OfficeSheetSelector

Usage

Explore 3 API references to this type

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

Returned or exposed by 1

Accepted by parameters 2

Constructors

public OfficeSheetSelector(string? name = null, int? position = null) #
JsonConstructor

Creates a persistable name/pattern or position selector. Exactly one value is required.

Parameters

name string? = null optional
position int? = null optional

Methods

public static OfficeSheetSelector From(object value) #

Creates a selector from a string, integral position, existing selector, or worksheet. Hosts unwrap their own argument wrappers first.

Parameters

value object required
public static IReadOnlyList<ExcelSheet> ResolveMany(ExcelDocument document, IReadOnlyList<OfficeSheetSelector>? selectors, ExcelSheet? defaultSheet = null) #

Resolves selectors once against the loaded workbook, deduplicating in workbook order. Names support case-insensitive *, ?, bracket sets/ranges and backtick escapes. Unmatched or empty explicit selections are errors. Null selects the supplied default worksheet or all worksheets.

Parameters

document OfficeIMO.Excel.ExcelDocument required
selectors System.Collections.Generic.IReadOnlyList<OfficeIMO.Excel.OfficeSheetSelector>? required
defaultSheet OfficeIMO.Excel.ExcelSheet? = null optional

Returns

IReadOnlyList<ExcelSheet>
public static IReadOnlyList<string> ResolveNames(IReadOnlyList<string> sheetNames, IReadOnlyList<OfficeSheetSelector>? selectors) #

Resolves the same name/pattern and position selectors against an existing reader's worksheet names, without loading an editable workbook. Live worksheet identities require ResolveMany instead. Null selects all names; explicit empty or unmatched selections are errors. Results follow workbook order.

Parameters

sheetNames System.Collections.Generic.IReadOnlyList<string> required
selectors System.Collections.Generic.IReadOnlyList<OfficeIMO.Excel.OfficeSheetSelector>? required

Returns

IReadOnlyList<string>
public T Resolve<T>(IReadOnlyList<T> sheets, Func<T, string> getName) #

Resolves a literal name, position or live identity against a worksheet collection. Use ResolveMany for wildcard expansion.

Type Parameters

T

Parameters

sheets System.Collections.Generic.IReadOnlyList<T> required
getName System.Func<T, string> required

Returns

T

Properties

public string? Name { get; } #

Gets the name or wildcard pattern. A numeric string remains a name. Live selectors capture the name for persistence.

public int? Position { get; } #

Gets the one-based worksheet position, resolved when the workbook is available.

public ExcelSheet? Sheet { get; } #
JsonIgnore

Gets the live worksheet identity. JSON persists its captured name without serializing the document.