Click or drag to resize

IExcelWriter Interface

Provide methods for write data to an excel file.
Example
C#
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);
}

Namespace: Casewhere.Runtime.IO
Assembly: Casewhere.Runtime.IO (in Casewhere.Runtime.IO.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public interface IExcelWriter : IDisposable, 
	IIOApi

The IExcelWriter type exposes the following members.

Methods
 NameDescription
Public methodAddSheet Create a sheet with the given name.
Public methodClose Close the connection to an excel file.
Public methodDisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable)
Public methodGetSheet Get a sheet with its index.
Public methodOpen(FileInfo) Connect to an excel file to prepare for writing.
Public methodOpen(Stream) Connect to the stream of an excel file to prepare for writing
Top
See Also