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
StreamThe 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
StreamThe stream to write the Excel document to.
stylesheet
StylesheetThe 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
StreamThe stream to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe 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
StreamThe stream to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
stylesheet
StylesheetThe 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
StreamThe stream to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmpty
boolA 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
StreamThe stream to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmpty
boolA 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
StylesheetThe 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
StreamThe stream to write the Excel document to.
skipCellWhenEmpty
boolA 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
stringThe 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.
public BigExcelWriter(string path, Stylesheet stylesheet)
Parameters
path
stringThe file path to write the Excel document to.
stylesheet
StylesheetThe 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
stringThe file path to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe 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
stringThe file path to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
stylesheet
StylesheetThe 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
stringThe file path to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmpty
boolA 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
stringThe file path to write the Excel document to.
spreadsheetDocumentType
SpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmpty
boolA 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
StylesheetThe 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
stringThe file path to write the Excel document to.
skipCellWhenEmpty
boolA 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
Path
Gets the file path where the Excel document is being saved.
(null when not saving to file)
public string Path { get; }
Property Value
PrintGridLinesInCurrentSheet
Gets or sets a value indicating whether to print grid lines in the current sheet.
public bool PrintGridLinesInCurrentSheet { get; set; }
Property Value
Remarks
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
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
Remarks
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
Remarks
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
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
Stream
Gets the Stream where the Excel document is being saved.
(null when not saving to Stream)
public Stream Stream { get; }
Property Value
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
CellRangeThe range where the autofilter should be applied.
overwrite
boolIf 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
isnull
.- SheetAlreadyHasFilterException
Thrown when there is already an autofilter in the current sheet and
overwrite
isfalse
.- 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
stringThe range where the autofilter should be applied.
overwrite
boolIf 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
isnull
.- SheetAlreadyHasFilterException
Thrown when there is already an autofilter in the current sheet and
overwrite
isfalse
.- 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
CellRangeThe cell range to apply the conditional formatting to.
operator
ConditionalFormattingOperatorValuesThe operator to use for the conditional formatting rule.
value
stringThe value to compare the cell value against.
format
intThe format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)
value2
stringThe second value to compare the cell value against, used for "Between" and "NotBetween" operators.
Exceptions
- ArgumentNullException
Thrown when
cellRange
,value
, orvalue2
(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
stringThe cell range to apply the conditional formatting to.
operator
ConditionalFormattingOperatorValuesThe operator to use for the conditional formatting rule.
value
stringThe value to compare the cell value against.
format
intThe format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)
value2
stringThe second value to compare the cell value against, used for "Between" and "NotBetween" operators.
Exceptions
- ArgumentNullException
Thrown when
reference
,value
, orvalue2
(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
CellRangeThe cell range to apply the conditional formatting to.
format
intThe 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
stringThe cell range to apply the conditional formatting to.
format
intThe 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
CellRangeThe cell range to apply the conditional formatting to.
formula
stringThe formula that determines the conditional formatting rule.
format
intThe 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
orformula
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
stringThe cell range to apply the conditional formatting to.
formula
stringThe formula that determines the conditional formatting rule.
format
intThe 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
orformula
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
CellRangeThe cell range to apply the validation to.
firstOperand
decimalThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
firstOperand
doubleThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
firstOperand
floatThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
decimalThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
doubleThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
floatThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
firstOperand
intThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
firstOperand
longThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
firstOperand
uintThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
firstOperand
ulongThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
intThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
longThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
uintThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
stringThe cell range to apply the validation to.
firstOperand
ulongThe first operand for the validation.
validationType
DataValidationOperatorValuesThe type of validation to apply.
allowBlank
boolIf set to
true
, blank values are allowed.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- ArgumentNullException
Thrown when the
range
isnull
.- 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
CellRangeThe cell range to apply the validation to.
formula
stringThe formula defining the list of valid values.
allowBlank
boolIf set to
true
, blank values are considered valid.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.
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
stringThe cell range to apply the validation to.
formula
stringThe formula defining the list of valid values.
allowBlank
boolIf set to
true
, blank values are considered valid.showInputMessage
boolIf set to
true
, an input message will be shown.showErrorMessage
boolIf 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
isnull
.- 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
boolIndicates 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
intThe 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
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
stringThe text of the comment.
cellRange
CellRangeThe cell range where the comment will be added. Must be a single cell range.
author
stringThe author of the comment. Default is "BigExcelCreator".
Exceptions
- ArgumentOutOfRangeException
Thrown when
author
is null or empty, or whencellRange
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
stringThe text of the comment.
reference
stringThe cell range where the comment will be added. Must be a single cell range.
author
stringThe author of the comment. Default is "BigExcelCreator".
Exceptions
- ArgumentOutOfRangeException
Thrown when
author
is null or empty, or whenreference
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
stringThe 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
stringThe name of the sheet to create and open.
sheetState
SheetStateValuesSets 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
stringThe 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
stringThe 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
SheetStateValuesSets 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
CellRangeThe 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
stringThe 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
stringThe formula to write in the cell.
format
intThe 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
byteThe number to write in the cell.
format
intThe 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
decimalThe number to write in the cell.
format
intThe 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
doubleThe number to write in the cell.
format
intThe 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
shortThe number to write in the cell.
format
intThe 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
intThe number to write in the cell.
format
intThe 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
longThe number to write in the cell.
format
intThe 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
sbyteThe number to write in the cell.
format
intThe 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
floatThe number to write in the cell.
format
intThe 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
ushortThe number to write in the cell.
format
intThe 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
uintThe number to write in the cell.
format
intThe 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
ulongThe number to write in the cell.
format
intThe 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates 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
stringThe text to write in the cell.
format
intThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
useSharedStrings
boolIndicates 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
intThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hidden
boolIndicates whether the row should be hidden. Default is false.
useSharedStrings
boolIndicates 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