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
streamStreamThe 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
streamStreamThe stream to write the Excel document to.
stylesheetStylesheetThe 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
streamStreamThe stream to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe 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
streamStreamThe stream to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
stylesheetStylesheetThe 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
streamStreamThe stream to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmptyboolA 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
streamStreamThe stream to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmptyboolA 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.
stylesheetStylesheetThe 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
streamStreamThe stream to write the Excel document to.
skipCellWhenEmptyboolA 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
pathstringThe 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
pathstringThe file path to write the Excel document to.
stylesheetStylesheetThe 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
pathstringThe file path to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe 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
pathstringThe file path to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
stylesheetStylesheetThe 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
pathstringThe file path to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmptyboolA 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
pathstringThe file path to write the Excel document to.
spreadsheetDocumentTypeSpreadsheetDocumentTypeThe type of the spreadsheet document (e.g., Workbook, Template).
skipCellWhenEmptyboolA 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.
stylesheetStylesheetThe 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
pathstringThe file path to write the Excel document to.
skipCellWhenEmptyboolA 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
rangeCellRangeThe range where the autofilter should be applied.
overwriteboolIf 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
rangeisnull.- SheetAlreadyHasFilterException
Thrown when there is already an autofilter in the current sheet and
overwriteisfalse.- ArgumentOutOfRangeException
Thrown when the height of the
rangeis 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
rangestringThe range where the autofilter should be applied.
overwriteboolIf 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
rangedoes not represent a valid range.- NoOpenSheetException
Thrown when there is no open sheet to add the autofilter to.
- ArgumentNullException
Thrown when the
rangeisnull.- SheetAlreadyHasFilterException
Thrown when there is already an autofilter in the current sheet and
overwriteisfalse.- ArgumentOutOfRangeException
Thrown when the height of the
rangeis 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
cellRangeCellRangeThe cell range to apply the conditional formatting to.
operatorConditionalFormattingOperatorValuesThe operator to use for the conditional formatting rule.
valuestringThe value to compare the cell value against.
formatintThe format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)
value2stringThe 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
formatis 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
referencestringThe cell range to apply the conditional formatting to.
operatorConditionalFormattingOperatorValuesThe operator to use for the conditional formatting rule.
valuestringThe value to compare the cell value against.
formatintThe format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)
value2stringThe 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
formatis negative.- NoOpenSheetException
Thrown when there is no open sheet to add the conditional formatting to.
- InvalidRangeException
Thrown when the
referencedoes 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
cellRangeCellRangeThe cell range to apply the conditional formatting to.
formatintThe format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)
Exceptions
- ArgumentNullException
Thrown when
cellRangeis null.- ArgumentOutOfRangeException
Thrown when
formatis 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
referencestringThe cell range to apply the conditional formatting to.
formatintThe format ID of the differential format in stylesheet to apply when the condition is met. See GetIndexDifferentialByName(string)
Exceptions
- ArgumentNullException
Thrown when
referenceis null.- ArgumentOutOfRangeException
Thrown when
formatis negative.- NoOpenSheetException
Thrown when there is no open sheet to add the conditional formatting to.
- InvalidRangeException
Thrown when the
referencedoes 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
cellRangeCellRangeThe cell range to apply the conditional formatting to.
formulastringThe formula that determines the conditional formatting rule.
formatintThe 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
cellRangeorformulais null.- ArgumentOutOfRangeException
Thrown when
formatis 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
referencestringThe cell range to apply the conditional formatting to.
formulastringThe formula that determines the conditional formatting rule.
formatintThe 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
referenceorformulais null.- ArgumentOutOfRangeException
Thrown when
formatis negative.- InvalidRangeException
Thrown when the
referencedoes 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
rangeCellRangeThe cell range to apply the validation to.
firstOperanddecimalThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperanddecimal?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangeCellRangeThe cell range to apply the validation to.
firstOperanddoubleThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperanddouble?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangeCellRangeThe cell range to apply the validation to.
firstOperandfloatThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandfloat?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangestringThe cell range to apply the validation to.
firstOperanddecimalThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperanddecimal?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangestringThe cell range to apply the validation to.
firstOperanddoubleThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperanddouble?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangestringThe cell range to apply the validation to.
firstOperandfloatThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandfloat?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangeCellRangeThe cell range to apply the validation to.
firstOperandintThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandint?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangeCellRangeThe cell range to apply the validation to.
firstOperandlongThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandlong?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangeCellRangeThe cell range to apply the validation to.
firstOperanduintThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperanduint?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangeCellRangeThe cell range to apply the validation to.
firstOperandulongThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandulong?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- 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
rangestringThe cell range to apply the validation to.
firstOperandintThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandint?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangestringThe cell range to apply the validation to.
firstOperandlongThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandlong?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangestringThe cell range to apply the validation to.
firstOperanduintThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperanduint?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangestringThe cell range to apply the validation to.
firstOperandulongThe first operand for the validation.
validationTypeDataValidationOperatorValuesThe type of validation to apply.
allowBlankboolIf set to
true, blank values are allowed.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf set to
true, an error message will be shown when invalid data is entered.secondOperandulong?The second operand for the validation, if required by the validation type.
Exceptions
- ArgumentNullException
Thrown when the validation type requires a second operand but
secondOperandisnull.- ArgumentNullException
Thrown when the
rangeisnull.- NoOpenSheetException
Thrown when there is no open sheet to add the validation to.
- InvalidRangeException
Thrown when the
rangedoes 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
rangeCellRangeThe cell range to apply the validation to.
formulastringThe formula defining the list of valid values.
allowBlankboolIf set to
true, blank values are considered valid.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf 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
rangeisnull.
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
rangestringThe cell range to apply the validation to.
formulastringThe formula defining the list of valid values.
allowBlankboolIf set to
true, blank values are considered valid.showInputMessageboolIf set to
true, an input message will be shown.showErrorMessageboolIf 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
rangeisnull.- InvalidRangeException
Thrown when the
rangedoes 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
hiddenboolIndicates 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
rownumintThe 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
textstringThe text of the comment.
cellRangeCellRangeThe cell range where the comment will be added. Must be a single cell range.
authorstringThe author of the comment. Default is "BigExcelCreator".
Exceptions
- ArgumentOutOfRangeException
Thrown when
authoris null or empty, or whencellRangeis not a single cell range.- ArgumentNullException
Thrown when
cellRangeis 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
textstringThe text of the comment.
referencestringThe cell range where the comment will be added. Must be a single cell range.
authorstringThe author of the comment. Default is "BigExcelCreator".
Exceptions
- ArgumentOutOfRangeException
Thrown when
authoris null or empty, or whenreferenceis not a single cell range.- ArgumentNullException
Thrown when
referenceis null.- NoOpenSheetException
Thrown when there is no open sheet to add the comment to.
- InvalidRangeException
Thrown when the
referencedoes 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
namestringThe 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
namestringThe name of the sheet to create and open.
sheetStateSheetStateValuesSets sheet visibility.
SheetStateValues.Visibleto list the sheet.SheetStateValues.Hiddento hide it.SheetStateValues.VeryHiddento 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
namestringThe name of the sheet to create and open.
columnsIList<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
namestringThe name of the sheet to create and open.
columnsIList<Column>The columns to add to the sheet. Can be null. Use this to set the columns' width.
sheetStateSheetStateValuesSets sheet visibility.
SheetStateValues.Visibleto list the sheet.SheetStateValues.Hiddento hide it.SheetStateValues.VeryHiddento 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
disposingbool
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
rangeCellRangeThe cell range to merge.
Exceptions
- ArgumentNullException
Thrown when
rangeis 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
rangestringThe cell range to merge.
Exceptions
- ArgumentNullException
Thrown when
rangeis 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
rangedoes 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
formulastringThe formula to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string)
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
formulasIEnumerable<string>The collection of formulas to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numberbyteThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberdecimalThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberdoubleThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numbershortThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberintThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberlongThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numbersbyteThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberfloatThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberushortThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberuintThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numberulongThe number to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
Exceptions
- ArgumentOutOfRangeException
Thrown when
formatis 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
numbersIEnumerable<byte>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<decimal>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<double>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<short>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<int>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<long>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<sbyte>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<float>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<ushort>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<uint>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
numbersIEnumerable<ulong>The collection of numbers to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates 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
formatis 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
textstringThe text to write in the cell.
formatintThe format index to apply to the cell. Default is 0. See GetIndexByName(string).
useSharedStringsboolIndicates 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
formatis 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
textsIEnumerable<string>The collection of text strings to write in the row.
formatintThe format index to apply to each cell. Default is 0. See GetIndexByName(string)
hiddenboolIndicates whether the row should be hidden. Default is false.
useSharedStringsboolIndicates 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
formatis less than 0