Table of Contents

Class XlsxSheet

Namespace
DocToolkit
Assembly
DocToolkit.dll

One named sheet and its rows, for building a multi-sheet workbook from data rather than a template.

Content comes from data rather than a template, so there is no source file to edit. Cell typing and culture rules are identical to the single-sheet Create(string, IEnumerable<IEnumerable<object?>>); a cell holding an XlsxFormula is written as a formula.

There is deliberately no separate header row. A header is styling, and this type carries content — the first row is a header only in the sense that you put your headings in it.

public sealed class XlsxSheet
Inheritance
XlsxSheet
Inherited Members

Properties

Name

The sheet's name, as it appears on the tab.

public string Name { get; }

Property Value

string

Rows

The rows, materialised at construction so a lazy sequence cannot be enumerated twice.

public IReadOnlyList<IReadOnlyList<object?>> Rows { get; }

Property Value

IReadOnlyList<IReadOnlyList<object>>

Methods

Named(string, IEnumerable<IEnumerable<object?>>)

Creates a sheet. rows is materialised immediately, so a lazy or single-pass sequence is safe to pass. Both the sequence and each row are deep-copied here; mutating the caller's collection, or a row within it, afterwards does not change the sheet.

public static XlsxSheet Named(string name, IEnumerable<IEnumerable<object?>> rows)

Parameters

name string
rows IEnumerable<IEnumerable<object>>

Returns

XlsxSheet

Exceptions

ArgumentNullException

name or rows is null.

ArgumentException

name is empty, longer than 31 characters, or contains a character Excel forbids in a sheet name; or an element of rows is null.