C# Class FileHelpers.ExcelNPOIStorage.ExcelNPOIStorage

This class implements the DataStorage for Microsoft Excel Files using the NPOI library.

WARNING you need to reference NPOI.dll in your project to use this feature.

To use this class you need to reference the FileHelpers.ExcelNPOIStorage.dll file.

Inheritance: FileHelpers.DataLink.DataStorage
Show file Open project: MarcosMeli/FileHelpers Class Usage Examples

Public Methods

Method Description
ExcelNPOIStorage ( Type recordType ) : System

Create a new ExcelStorage to work with the specified type

ExcelNPOIStorage ( Type recordType, int startRow, int startCol ) : System

Create a new ExcelStorage to work with the specified type

ExcelNPOIStorage ( Type recordType, string fileName, int startRow, int startCol ) : System

Create a new ExcelStorage to work with the specified type

ExtractRecords ( ) : object[]

Returns the records extracted from Excel file.

InsertRecords ( object records ) : void

Insert all the records in the specified Excel File.

Protected Methods

Method Description
CellAsString ( object row, object col ) : string

Get the string value of a cell

Private Methods

Method Description
AddHeaderColumns ( int startCol, int rowNum ) : void
CellAsString ( IRow row, int col ) : string
CloseAndCleanUp ( ) : void
ColumnsToValues ( object values ) : string
CreateWorkbook ( string filename ) : void
InitExcel ( ) : void
OpenOrCreateWorkbook ( string filename ) : void
OpenWorkbook ( string filename ) : void
RowValues ( int rowNum, int startCol, int numberOfCols ) : object[]
SaveWorkbook ( ) : void
SaveWorkbook ( string filename ) : void
WriteRowValues ( object values, int rowNum, int startCol ) : void

Method Details

CellAsString() protected method

Get the string value of a cell
protected CellAsString ( object row, object col ) : string
row object Cell Row
col object Cell Column
return string

ExcelNPOIStorage() public method

Create a new ExcelStorage to work with the specified type
public ExcelNPOIStorage ( Type recordType ) : System
recordType System.Type The type of records.
return System

ExcelNPOIStorage() public method

Create a new ExcelStorage to work with the specified type
public ExcelNPOIStorage ( Type recordType, int startRow, int startCol ) : System
recordType System.Type The type of records.
startRow int The row of the first data cell. Begining in 1.
startCol int The column of the first data cell. Begining in 1.
return System

ExcelNPOIStorage() public method

Create a new ExcelStorage to work with the specified type
public ExcelNPOIStorage ( Type recordType, string fileName, int startRow, int startCol ) : System
recordType System.Type The type of records.
fileName string The file path to work with.
startRow int The row of the first data cell. Begining in 1.
startCol int The column of the first data cell. Begining in 1.
return System

ExtractRecords() public method

Returns the records extracted from Excel file.
public ExtractRecords ( ) : object[]
return object[]

InsertRecords() public method

Insert all the records in the specified Excel File.
public InsertRecords ( object records ) : void
records object The records to insert.
return void