IExcel
|
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 interface IExcelWriter : IDisposable, IIOApi
The IExcelWriter type exposes the following members.
Name | Description | |
---|---|---|
![]() | AddSheet | Create a sheet with the given name. |
![]() | Close | Close the connection to an excel file. |
![]() | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable) |
![]() | GetSheet | Get a sheet with its index. |
![]() | Open(FileInfo) | Connect to an excel file to prepare for writing. |
![]() | Open(Stream) | Connect to the stream of an excel file to prepare for writing |