Click or drag to resize

Casewhere.Runtime.IO Namespace

 
Classes
  ClassDescription
Public classReaders
A factory to create an excel reader.
Public classWriters
A factory to create an excel writer.
Interfaces
  InterfaceDescription
Public interfaceIExcelCellWriter
Provide methods for working with an excel cell.
Public interfaceCode exampleIExcelReader
Provide methods for reading an excel file.
Examples
var reader = Readers.GetExcelReader();
using(reader.Open(documentApi.OpenRead(ctx.Input.DocumentAttribute)))
{
    var workSheetReader = reader.GetSheet(0);
    var rowCount = workSheetReader.RowCount;
    var columnCount = workSheetReader.ColumnCount;
    for (int row = 0; row < rowCount; row++) {
        for (int col = 0; col < columnCount; col++) {
            var value = workSheetReader.Read<string>(row, col);
        }
    }
}
Public interfaceIExcelSheetWriter
Public interfaceCode exampleIExcelWriter
Provide methods for write data to an excel file.
Examples
var filter = FilterBuilder.Create().Build();
var schools = dataApi.Search(DataObjectApiQuery.For("School").FilterBy(filter)).Data;
using(var stream = new MemoryStream())
{
    using (var writer = Writers.GetExcelWriter())
    {
        writer.Open(stream);
        var sheetWriter = writer.AddSheet("Sheet1");
        var row = 0;
        foreach(dynamic school in schools) {            
            sheetWriter.Write(row, 0, school.Name);
            sheetWriter.Write(row, 1, school.Description);
            row ++;
        }       
    }

    // Note: MUST move the cursor to the beginning of the stream before storing.
    stream.Seek(0, SeekOrigin.Begin);
    var documentInfo = documentApi.Create("Sample.xlsx");
    documentApi.Store(documentInfo, stream);
}
Public interfaceIIOApi
Public interfaceIWorkSheetReader
Provide methods for reading data in a worksheet.
Enumerations
  EnumerationDescription
Public enumerationAlignment
Alignment types in horizontal.
Public enumerationVAlignment
Alignment types in vertical.