Table of Contents

Class BigExcelWriter

Namespace
BigExcelCreator
Assembly
BigExcelCreator.dll

This class writes Excel files directly using OpenXML SAX. Useful when trying to write tens of thousands of rows.

public class BigExcelWriter : IDisposable
Inheritance
BigExcelWriter
Implements
Inherited Members

Remarks

Constructors

BigExcelWriter(Stream)

Initializes a new instance of the BigExcelWriter class with the specified stream and spreadsheet document type.

public BigExcelWriter(Stream stream)

Parameters

stream Stream

The stream to write the Excel document to.

Remarks

Initializes a new Workbook

BigExcelWriter(Stream, Stylesheet)

Initializes a new instance of the BigExcelWriter class with the specified stream, spreadsheet document type, and stylesheet.

public BigExcelWriter(Stream stream, Stylesheet stylesheet)

Parameters

stream Stream

The stream to write the Excel document to.

stylesheet Stylesheet

The stylesheet to apply to the Excel document. See GetStylesheet().

Remarks

Initializes a new Workbook

BigExcelWriter(Stream, SpreadsheetDocumentType)

Initializes a new instance of the BigExcelWriter class with the specified stream and spreadsheet document type.

public BigExcelWriter(Stream stream, SpreadsheetDocumentType spreadsheetDocumentType)

Parameters

stream Stream

The stream to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

BigExcelWriter(Stream, SpreadsheetDocumentType, Stylesheet)

Initializes a new instance of the BigExcelWriter class with the specified stream, spreadsheet document type, and stylesheet.

public BigExcelWriter(Stream stream, SpreadsheetDocumentType spreadsheetDocumentType, Stylesheet stylesheet)

Parameters

stream Stream

The stream to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

stylesheet Stylesheet

The stylesheet to apply to the Excel document. See GetStylesheet().

BigExcelWriter(Stream, SpreadsheetDocumentType, bool)

Initializes a new instance of the BigExcelWriter class with the specified stream, spreadsheet document type, and a flag indicating whether to skip cells when they are empty.

public BigExcelWriter(Stream stream, SpreadsheetDocumentType spreadsheetDocumentType, bool skipCellWhenEmpty)

Parameters

stream Stream

The stream to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

skipCellWhenEmpty bool

A flag indicating whether to skip cells when they are empty. When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

BigExcelWriter(Stream, SpreadsheetDocumentType, bool, Stylesheet)

Initializes a new instance of the BigExcelWriter class with the specified stream, spreadsheet document type, a flag indicating whether to skip cells when they are empty, and a stylesheet.

public BigExcelWriter(Stream stream, SpreadsheetDocumentType spreadsheetDocumentType, bool skipCellWhenEmpty, Stylesheet stylesheet)

Parameters

stream Stream

The stream to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

skipCellWhenEmpty bool

A flag indicating whether to skip cells when they are empty. When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

stylesheet Stylesheet

The stylesheet to apply to the Excel document. See GetStylesheet().

BigExcelWriter(Stream, bool)

Initializes a new instance of the BigExcelWriter class with the specified stream, spreadsheet document type, and a flag indicating whether to skip cells when they are empty.

public BigExcelWriter(Stream stream, bool skipCellWhenEmpty)

Parameters

stream Stream

The stream to write the Excel document to.

skipCellWhenEmpty bool

A flag indicating whether to skip cells when they are empty. When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

Remarks

Initializes a new Workbook

BigExcelWriter(string)

Initializes a new instance of the BigExcelWriter class with the specified file path and spreadsheet document type.

public BigExcelWriter(string path)

Parameters

path string

The file path to write the Excel document to.

Remarks

Initializes a new Workbook

BigExcelWriter(string, Stylesheet)

Initializes a new instance of the BigExcelWriter class with the specified file path, spreadsheet document type, and stylesheet. Initializes a new Workbook

public BigExcelWriter(string path, Stylesheet stylesheet)

Parameters

path string

The file path to write the Excel document to.

stylesheet Stylesheet

The stylesheet to apply to the Excel document. See GetStylesheet()

BigExcelWriter(string, SpreadsheetDocumentType)

Initializes a new instance of the BigExcelWriter class with the specified file path and spreadsheet document type.

public BigExcelWriter(string path, SpreadsheetDocumentType spreadsheetDocumentType)

Parameters

path string

The file path to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

BigExcelWriter(string, SpreadsheetDocumentType, Stylesheet)

Initializes a new instance of the BigExcelWriter class with the specified file path, spreadsheet document type, and stylesheet.

public BigExcelWriter(string path, SpreadsheetDocumentType spreadsheetDocumentType, Stylesheet stylesheet)

Parameters

path string

The file path to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

stylesheet Stylesheet

The stylesheet to apply to the Excel document. See GetStylesheet()

BigExcelWriter(string, SpreadsheetDocumentType, bool)

Initializes a new instance of the BigExcelWriter class with the specified file path, spreadsheet document type, and a flag indicating whether to skip cells when they are empty.

public BigExcelWriter(string path, SpreadsheetDocumentType spreadsheetDocumentType, bool skipCellWhenEmpty)

Parameters

path string

The file path to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

skipCellWhenEmpty bool

A flag indicating whether to skip cells when they are empty. When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

BigExcelWriter(string, SpreadsheetDocumentType, bool, Stylesheet)

Initializes a new instance of the BigExcelWriter class with the specified file path, spreadsheet document type, a flag indicating whether to skip cells when they are empty, and a stylesheet.

public BigExcelWriter(string path, SpreadsheetDocumentType spreadsheetDocumentType, bool skipCellWhenEmpty, Stylesheet stylesheet)

Parameters

path string

The file path to write the Excel document to.

spreadsheetDocumentType SpreadsheetDocumentType

The type of the spreadsheet document (e.g., Workbook, Template).

skipCellWhenEmpty bool

A flag indicating whether to skip cells when they are empty. When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

stylesheet Stylesheet

The stylesheet to apply to the Excel document. See GetStylesheet().

BigExcelWriter(string, bool)

Initializes a new instance of the BigExcelWriter class with the specified file path, spreadsheet document type, and a flag indicating whether to skip cells when they are empty.

public BigExcelWriter(string path, bool skipCellWhenEmpty)

Parameters

path string

The file path to write the Excel document to.

skipCellWhenEmpty bool

A flag indicating whether to skip cells when they are empty. When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

Remarks

Initializes a new Workbook

Properties

Document

Gets the SpreadsheetDocument object representing the Excel document.

public SpreadsheetDocument Document { get; }

Property Value

SpreadsheetDocument

Path

Gets the file path where the Excel document is being saved.

(null when not saving to file)

public string Path { get; }

Property Value

string

PrintGridLinesInCurrentSheet

Gets or sets a value indicating whether to print grid lines in the current sheet.

public bool PrintGridLinesInCurrentSheet { get; set; }

Property Value

bool

Remarks

When true, Prints gridlines. When false, Doesn't print gridlines (default).

Exceptions

NoOpenSheetException

When there is no open sheet

PrintRowAndColumnHeadingsInCurrentSheet

Gets or sets a value indicating whether to print row and column headings in the current sheet.

public bool PrintRowAndColumnHeadingsInCurrentSheet { get; set; }

Property Value

bool

Remarks

When true, Prints row and column headings. When false, Doesn't print row and column headings (default).

Exceptions

NoOpenSheetException

When there is no open sheet

ShowGridLinesInCurrentSheet

Gets or sets a value indicating whether to show grid lines in the current sheet.

public bool ShowGridLinesInCurrentSheet { get; set; }

Property Value

bool

Remarks

When true, shows gridlines on screen (default). When false, hides gridlines on screen.

Exceptions

NoOpenSheetException

When there is no open sheet

ShowRowAndColumnHeadingsInCurrentSheet

Gets or sets a value indicating whether to show row and column headings in the current sheet.

public bool ShowRowAndColumnHeadingsInCurrentSheet { get; set; }

Property Value

bool

Remarks

When true, shows row and column headings (default). When false, hides row and column headings.

Exceptions

NoOpenSheetException

When there is no open sheet

SkipCellWhenEmpty

Gets or sets a value indicating whether to skip cells when they are empty.

public bool SkipCellWhenEmpty { get; set; }

Property Value

bool

Remarks

When true, writing an empty value to a cell moves the next cell to be written. When false, writing an empty value to a cell does nothing.

SpreadsheetDocumentType

Gets the type of the spreadsheet document (e.g., Workbook, Template).

only SpreadsheetDocumentType.Workbook is tested

public SpreadsheetDocumentType SpreadsheetDocumentType { get; }

Property Value

SpreadsheetDocumentType

Stream

Gets the Stream where the Excel document is being saved.

(null when not saving to Stream)

public Stream Stream { get; }

Property Value

Stream

Methods

AddAutofilter(CellRange, bool)

Adds an autofilter to the specified range in the current sheet.

public void AddAutofilter(CellRange range, bool overwrite = false)

Parameters

range CellRange

The range where the autofilter should be applied.

overwrite bool

If set to true, any existing autofilter will be replaced.

Remarks

The range height must be 1.

Only one filter per sheet is allowed.

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to add the autofilter to.

ArgumentNullException

Thrown when the range is null.

SheetAlreadyHasFilterException

Thrown when there is already an autofilter in the current sheet and overwrite is false.

ArgumentOutOfRangeException

Thrown when the height of the range is not 1.

AddAutofilter(string, bool)

Adds an autofilter to the specified range in the current sheet.

public void AddAutofilter(string range, bool overwrite = false)

Parameters

range string

The range where the autofilter should be applied.

overwrite bool

If set to true, any existing autofilter will be replaced.

Remarks

The range height must be 1.

Only one filter per sheet is allowed.

Exceptions

InvalidRangeException

Thrown when the range does not represent a valid range.

NoOpenSheetException

Thrown when there is no open sheet to add the autofilter to.

ArgumentNullException

Thrown when the range is null.

SheetAlreadyHasFilterException

Thrown when there is already an autofilter in the current sheet and overwrite is false.

ArgumentOutOfRangeException

Thrown when the height of the range is not 1.

AddConditionalFormattingCellIs(CellRange, ConditionalFormattingOperatorValues, string, int, string)

Adds a conditional formatting rule based on a cell value to the specified cell range.

public void AddConditionalFormattingCellIs(CellRange cellRange, ConditionalFormattingOperatorValues @operator, string value, int format, string value2 = null)

Parameters

cellRange CellRange

The cell range to apply the conditional formatting to.

operator ConditionalFormattingOperatorValues

The operator to use for the conditional formatting rule.

value string

The value to compare the cell value against.

format int

The format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)

value2 string

The second value to compare the cell value against, used for "Between" and "NotBetween" operators.

Exceptions

ArgumentNullException

Thrown when cellRange, value, or value2 (if required) is null.

ArgumentOutOfRangeException

Thrown when format is negative.

NoOpenSheetException

Thrown when there is no open sheet to add the conditional formatting to.

AddConditionalFormattingCellIs(string, ConditionalFormattingOperatorValues, string, int, string)

Adds a conditional formatting rule based on a cell value to the specified cell range.

public void AddConditionalFormattingCellIs(string reference, ConditionalFormattingOperatorValues @operator, string value, int format, string value2 = null)

Parameters

reference string

The cell range to apply the conditional formatting to.

operator ConditionalFormattingOperatorValues

The operator to use for the conditional formatting rule.

value string

The value to compare the cell value against.

format int

The format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)

value2 string

The second value to compare the cell value against, used for "Between" and "NotBetween" operators.

Exceptions

ArgumentNullException

Thrown when reference, value, or value2 (if required) is null.

ArgumentOutOfRangeException

Thrown when format is negative.

NoOpenSheetException

Thrown when there is no open sheet to add the conditional formatting to.

InvalidRangeException

Thrown when the reference does not represent a valid range.

AddConditionalFormattingDuplicatedValues(CellRange, int)

Adds a conditional formatting rule to highlight duplicated values in the specified cell range.

public void AddConditionalFormattingDuplicatedValues(CellRange cellRange, int format)

Parameters

cellRange CellRange

The cell range to apply the conditional formatting to.

format int

The format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)

Exceptions

ArgumentNullException

Thrown when cellRange is null.

ArgumentOutOfRangeException

Thrown when format is negative.

NoOpenSheetException

Thrown when there is no open sheet to add the conditional formatting to.

AddConditionalFormattingDuplicatedValues(string, int)

Adds a conditional formatting rule to highlight duplicated values in the specified cell range.

public void AddConditionalFormattingDuplicatedValues(string reference, int format)

Parameters

reference string

The cell range to apply the conditional formatting to.

format int

The format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)

Exceptions

ArgumentNullException

Thrown when reference is null.

ArgumentOutOfRangeException

Thrown when format is negative.

NoOpenSheetException

Thrown when there is no open sheet to add the conditional formatting to.

InvalidRangeException

Thrown when the reference does not represent a valid range.

AddConditionalFormattingFormula(CellRange, string, int)

Adds a conditional formatting rule based on a formula to the specified cell range.

public void AddConditionalFormattingFormula(CellRange cellRange, string formula, int format)

Parameters

cellRange CellRange

The cell range to apply the conditional formatting to.

formula string

The formula that determines the conditional formatting rule.

format int

The format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to add the conditional formatting to.

ArgumentNullException

Thrown when cellRange or formula is null.

ArgumentOutOfRangeException

Thrown when format is negative.

AddConditionalFormattingFormula(string, string, int)

Adds a conditional formatting rule based on a formula to the specified cell range.

public void AddConditionalFormattingFormula(string reference, string formula, int format)

Parameters

reference string

The cell range to apply the conditional formatting to.

formula string

The formula that determines the conditional formatting rule.

format int

The format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to add the conditional formatting to.

ArgumentNullException

Thrown when reference or formula is null.

ArgumentOutOfRangeException

Thrown when format is negative.

InvalidRangeException

Thrown when the reference does not represent a valid range.

AddDecimalValidator(CellRange, decimal, DataValidationOperatorValues, bool, bool, bool, decimal?)

Adds a decimal data validation to the specified cell range.

public void AddDecimalValidator(CellRange range, decimal firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, decimal? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand decimal

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand decimal?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddDecimalValidator(CellRange, double, DataValidationOperatorValues, bool, bool, bool, double?)

Adds a decimal data validation to the specified cell range.

public void AddDecimalValidator(CellRange range, double firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, double? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand double

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand double?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddDecimalValidator(CellRange, float, DataValidationOperatorValues, bool, bool, bool, float?)

Adds a decimal data validation to the specified cell range.

public void AddDecimalValidator(CellRange range, float firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, float? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand float

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand float?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddDecimalValidator(string, decimal, DataValidationOperatorValues, bool, bool, bool, decimal?)

Adds a decimal data validation to the specified cell range.

public void AddDecimalValidator(string range, decimal firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, decimal? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand decimal

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand decimal?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddDecimalValidator(string, double, DataValidationOperatorValues, bool, bool, bool, double?)

Adds a decimal data validation to the specified cell range.

public void AddDecimalValidator(string range, double firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, double? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand double

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand double?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddDecimalValidator(string, float, DataValidationOperatorValues, bool, bool, bool, float?)

Adds a decimal data validation to the specified cell range.

public void AddDecimalValidator(string range, float firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, float? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand float

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand float?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddIntegerValidator(CellRange, int, DataValidationOperatorValues, bool, bool, bool, int?)

Adds an integer data validation to the specified cell range.

public void AddIntegerValidator(CellRange range, int firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, int? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand int

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand int?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddIntegerValidator(CellRange, long, DataValidationOperatorValues, bool, bool, bool, long?)

Adds an integer data validation to the specified cell range.

public void AddIntegerValidator(CellRange range, long firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, long? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand long

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand long?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddIntegerValidator(CellRange, uint, DataValidationOperatorValues, bool, bool, bool, uint?)

Adds an integer data validation to the specified cell range.

[CLSCompliant(false)]
public void AddIntegerValidator(CellRange range, uint firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, uint? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand uint

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand uint?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddIntegerValidator(CellRange, ulong, DataValidationOperatorValues, bool, bool, bool, ulong?)

Adds an integer data validation to the specified cell range.

[CLSCompliant(false)]
public void AddIntegerValidator(CellRange range, ulong firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, ulong? secondOperand = null)

Parameters

range CellRange

The cell range to apply the validation to.

firstOperand ulong

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand ulong?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

AddIntegerValidator(string, int, DataValidationOperatorValues, bool, bool, bool, int?)

Adds an integer data validation to the specified cell range.

public void AddIntegerValidator(string range, int firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, int? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand int

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand int?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddIntegerValidator(string, long, DataValidationOperatorValues, bool, bool, bool, long?)

Adds an integer data validation to the specified cell range.

public void AddIntegerValidator(string range, long firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, long? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand long

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand long?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddIntegerValidator(string, uint, DataValidationOperatorValues, bool, bool, bool, uint?)

Adds an integer data validation to the specified cell range.

[CLSCompliant(false)]
public void AddIntegerValidator(string range, uint firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, uint? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand uint

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand uint?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddIntegerValidator(string, ulong, DataValidationOperatorValues, bool, bool, bool, ulong?)

Adds an integer data validation to the specified cell range.

[CLSCompliant(false)]
public void AddIntegerValidator(string range, ulong firstOperand, DataValidationOperatorValues validationType, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true, ulong? secondOperand = null)

Parameters

range string

The cell range to apply the validation to.

firstOperand ulong

The first operand for the validation.

validationType DataValidationOperatorValues

The type of validation to apply.

allowBlank bool

If set to true, blank values are allowed.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

secondOperand ulong?

The second operand for the validation, if required by the validation type.

Exceptions

ArgumentNullException

Thrown when the validation type requires a second operand but secondOperand is null.

ArgumentNullException

Thrown when the range is null.

NoOpenSheetException

Thrown when there is no open sheet to add the validation to.

InvalidRangeException

Thrown when the range does not represent a valid range.

AddListValidator(CellRange, string, bool, bool, bool)

Adds a list data validation to the specified cell range.

public void AddListValidator(CellRange range, string formula, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true)

Parameters

range CellRange

The cell range to apply the validation to.

formula string

The formula defining the list of valid values.

allowBlank bool

If set to true, blank values are considered valid.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to add the autofilter to.

ArgumentNullException

Thrown when the range is null.

AddListValidator(string, string, bool, bool, bool)

Adds a list data validation to the specified cell range.

public void AddListValidator(string range, string formula, bool allowBlank = true, bool showInputMessage = true, bool showErrorMessage = true)

Parameters

range string

The cell range to apply the validation to.

formula string

The formula defining the list of valid values.

allowBlank bool

If set to true, blank values are considered valid.

showInputMessage bool

If set to true, an input message will be shown.

showErrorMessage bool

If set to true, an error message will be shown when invalid data is entered.

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to add the autofilter to.

ArgumentNullException

Thrown when the range is null.

InvalidRangeException

Thrown when the range does not represent a valid range.

BeginRow()

Begins a new row in the currently open sheet.

public void BeginRow()

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

OutOfOrderWritingException

Thrown when writing rows out of order is attempted.

BeginRow(bool)

Begins a new row in the currently open sheet.

public void BeginRow(bool hidden)

Parameters

hidden bool

Indicates whether the row should be hidden.

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

OutOfOrderWritingException

Thrown when writing rows out of order is attempted.

BeginRow(int)

Begins a new row in the currently open sheet.

public void BeginRow(int rownum)

Parameters

rownum int

The row number to begin.

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

OutOfOrderWritingException

Thrown when writing rows out of order is attempted.

BeginRow(int, bool)

Begins a new row in the currently open sheet.

public void BeginRow(int rownum, bool hidden)

Parameters

rownum int

The row number to begin.

hidden bool

Indicates whether the row should be hidden.

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

OutOfOrderWritingException

Thrown when writing rows out of order is attempted.

CloseDocument()

Closes the current document, ensuring all data is written and resources are released.

public void CloseDocument()

Remarks

This method will end any open rows and sheets, write shared strings and sheets, and save the document and worksheet part writer. If saving to a stream, it will reset the stream position to the beginning.

CloseSheet()

Closes the currently open sheet.

public void CloseSheet()

Exceptions

NoOpenSheetException

Thrown when there is no open sheet to close.

Comment(string, CellRange, string)

Adds a comment to a specified cell range.

public void Comment(string text, CellRange cellRange, string author = "BigExcelCreator")

Parameters

text string

The text of the comment.

cellRange CellRange

The cell range where the comment will be added. Must be a single cell range.

author string

The author of the comment. Default is "BigExcelCreator".

Exceptions

ArgumentOutOfRangeException

Thrown when author is null or empty, or when cellRange is not a single cell range.

ArgumentNullException

Thrown when cellRange is null.

NoOpenSheetException

Thrown when there is no open sheet to add the comment to.

Comment(string, string, string)

Adds a comment to a specified cell range.

public void Comment(string text, string reference, string author = "BigExcelCreator")

Parameters

text string

The text of the comment.

reference string

The cell range where the comment will be added. Must be a single cell range.

author string

The author of the comment. Default is "BigExcelCreator".

Exceptions

ArgumentOutOfRangeException

Thrown when author is null or empty, or when reference is not a single cell range.

ArgumentNullException

Thrown when reference is null.

NoOpenSheetException

Thrown when there is no open sheet to add the comment to.

InvalidRangeException

Thrown when the reference does not represent a valid range.

CreateAndOpenSheet(string)

Creates and opens a new sheet with the specified name, and prepares the writer to use it.

public void CreateAndOpenSheet(string name)

Parameters

name string

The name of the sheet to create and open.

Exceptions

SheetAlreadyOpenException

Thrown when a sheet is already open and not closed before opening a new one.

SheetNameCannotBeEmptyException

Thrown when the sheet name is null or empty.

SheetWithSameNameAlreadyExistsException

Thrown when a sheet with the same name already exists.

CreateAndOpenSheet(string, SheetStateValues)

Creates and opens a new sheet with the specified name, and sheet state, and prepares the writer to use it.

public void CreateAndOpenSheet(string name, SheetStateValues sheetState)

Parameters

name string

The name of the sheet to create and open.

sheetState SheetStateValues

Sets sheet visibility. SheetStateValues.Visible to list the sheet. SheetStateValues.Hidden to hide it. SheetStateValues.VeryHidden to hide it and prevent unhiding from the GUI.

Exceptions

SheetAlreadyOpenException

Thrown when a sheet is already open and not closed before opening a new one.

SheetNameCannotBeEmptyException

Thrown when the sheet name is null or empty.

SheetWithSameNameAlreadyExistsException

Thrown when a sheet with the same name already exists.

CreateAndOpenSheet(string, IList<Column>)

Creates and opens a new sheet with the specified name and columns, and prepares the writer to use it.

public void CreateAndOpenSheet(string name, IList<Column> columns)

Parameters

name string

The name of the sheet to create and open.

columns IList<Column>

The columns to add to the sheet. Can be null. Use this to set the columns' width.

Exceptions

SheetAlreadyOpenException

Thrown when a sheet is already open and not closed before opening a new one.

SheetNameCannotBeEmptyException

Thrown when the sheet name is null or empty.

SheetWithSameNameAlreadyExistsException

Thrown when a sheet with the same name already exists.

CreateAndOpenSheet(string, IList<Column>, SheetStateValues)

Creates and opens a new sheet with the specified name, columns, and sheet state, and prepares the writer to use it.

public void CreateAndOpenSheet(string name, IList<Column> columns, SheetStateValues sheetState)

Parameters

name string

The name of the sheet to create and open.

columns IList<Column>

The columns to add to the sheet. Can be null. Use this to set the columns' width.

sheetState SheetStateValues

Sets sheet visibility. SheetStateValues.Visible to list the sheet. SheetStateValues.Hidden to hide it. SheetStateValues.VeryHidden to hide it and prevent unhiding from the GUI.

Exceptions

SheetAlreadyOpenException

Thrown when a sheet is already open and not closed before opening a new one.

SheetNameCannotBeEmptyException

Thrown when the sheet name is null or empty.

SheetWithSameNameAlreadyExistsException

Thrown when a sheet with the same name already exists.

Dispose()

Closes the current document, ensuring all data is written and resources are released.

public void Dispose()

Remarks

This method will end any open rows and sheets, write shared strings and sheets, and save the document and worksheet part writer. If saving to a stream, it will reset the stream position to the beginning.

Dispose(bool)

Closes the current document, ensuring all data is written and resources are released.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Remarks

This method will end any open rows and sheets, write shared strings and sheets, and save the document and worksheet part writer. If saving to a stream, it will reset the stream position to the beginning.

EndRow()

Ends the currently open row in the sheet.

public void EndRow()

Exceptions

NoOpenRowException

Thrown when there is no open row to end.

~BigExcelWriter()

Finalizes an instance of the BigExcelWriter class.

protected ~BigExcelWriter()

MergeCells(CellRange)

Merges the specified cell range in the current sheet.

public void MergeCells(CellRange range)

Parameters

range CellRange

The cell range to merge.

Exceptions

ArgumentNullException

Thrown when range is null.

NoOpenSheetException

Thrown when there is no open sheet to merge the cells into.

OverlappingRangesException

Thrown when the specified range overlaps with an existing merged range.

MergeCells(string)

Merges the specified cell range in the current sheet.

public void MergeCells(string range)

Parameters

range string

The cell range to merge.

Exceptions

ArgumentNullException

Thrown when range is null.

NoOpenSheetException

Thrown when there is no open sheet to merge the cells into.

OverlappingRangesException

Thrown when the specified range overlaps with an existing merged range.

InvalidRangeException

Thrown when the range does not represent a valid range.

WriteFormulaCell(string, int)

Writes a formula cell to the currently open row in the sheet.

public void WriteFormulaCell(string formula, int format = 0)

Parameters

formula string

The formula to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string)

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteFormulaRow(IEnumerable<string>, int, bool)

Writes a row of formula cells to the currently open sheet.

public void WriteFormulaRow(IEnumerable<string> formulas, int format = 0, bool hidden = false)

Parameters

formulas IEnumerable<string>

The collection of formulas to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the formulas collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberCell(byte, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(byte number, int format = 0)

Parameters

number byte

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(decimal, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(decimal number, int format = 0)

Parameters

number decimal

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(double, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(double number, int format = 0)

Parameters

number double

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(short, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(short number, int format = 0)

Parameters

number short

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(int, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(int number, int format = 0)

Parameters

number int

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(long, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(long number, int format = 0)

Parameters

number long

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(sbyte, int)

Writes a numerical value to the currently open row in the sheet.

[CLSCompliant(false)]
public void WriteNumberCell(sbyte number, int format = 0)

Parameters

number sbyte

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(float, int)

Writes a numerical value to the currently open row in the sheet.

public void WriteNumberCell(float number, int format = 0)

Parameters

number float

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(ushort, int)

Writes a numerical value to the currently open row in the sheet.

[CLSCompliant(false)]
public void WriteNumberCell(ushort number, int format = 0)

Parameters

number ushort

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(uint, int)

Writes a numerical value to the currently open row in the sheet.

[CLSCompliant(false)]
public void WriteNumberCell(uint number, int format = 0)

Parameters

number uint

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberCell(ulong, int)

Writes a numerical value to the currently open row in the sheet.

[CLSCompliant(false)]
public void WriteNumberCell(ulong number, int format = 0)

Parameters

number ulong

The number to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

Exceptions

ArgumentOutOfRangeException

Thrown when format is less than 0

NoOpenRowException

Thrown when there is no open row to write the cell to.

WriteNumberRow(IEnumerable<byte>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<byte> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<byte>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<decimal>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<decimal> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<decimal>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<double>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<double> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<double>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<short>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<short> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<short>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<int>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<int> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<int>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<long>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<long> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<long>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<sbyte>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

[CLSCompliant(false)]
public void WriteNumberRow(IEnumerable<sbyte> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<sbyte>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<float>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

public void WriteNumberRow(IEnumerable<float> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<float>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<ushort>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

[CLSCompliant(false)]
public void WriteNumberRow(IEnumerable<ushort> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<ushort>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<uint>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

[CLSCompliant(false)]
public void WriteNumberRow(IEnumerable<uint> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<uint>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteNumberRow(IEnumerable<ulong>, int, bool)

Writes a row of cells with numerical values to the currently open sheet.

[CLSCompliant(false)]
public void WriteNumberRow(IEnumerable<ulong> numbers, int format = 0, bool hidden = false)

Parameters

numbers IEnumerable<ulong>

The collection of numbers to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

Exceptions

ArgumentNullException

Thrown when the numbers collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0

WriteTextCell(string, int, bool)

Writes a text cell to the currently open row in the sheet.

public void WriteTextCell(string text, int format = 0, bool useSharedStrings = false)

Parameters

text string

The text to write in the cell.

format int

The format index to apply to the cell. Default is 0. See GetIndexByName(string).

useSharedStrings bool

Indicates whether to write the value to the shared strings table. This might help reduce the output file size when the same text is shared multiple times among sheets. Default is false.

Exceptions

NoOpenRowException

Thrown when there is no open row to write the cell to.

ArgumentOutOfRangeException

When format is less than 0

WriteTextRow(IEnumerable<string>, int, bool, bool)

Writes a row of text cells to the currently open sheet.

public void WriteTextRow(IEnumerable<string> texts, int format = 0, bool hidden = false, bool useSharedStrings = false)

Parameters

texts IEnumerable<string>

The collection of text strings to write in the row.

format int

The format index to apply to each cell. Default is 0. See GetIndexByName(string)

hidden bool

Indicates whether the row should be hidden. Default is false.

useSharedStrings bool

Indicates whether to write the value to the shared strings table. This might help reduce the output file size when the same text is shared multiple times among sheets. Default is false.

Exceptions

ArgumentNullException

Thrown when the texts collection is null.

NoOpenSheetException

Thrown when there is no open sheet to write a row to.

RowAlreadyOpenException

Thrown when a row is already open. Use EndRow to close it.

ArgumentOutOfRangeException

Thrown when format is less than 0