Excel Reports
GenerateFromCsvStream Method
Example 



KellermanSoftware.ExcelReports Namespace > ExcelReportsGenerator Class : GenerateFromCsvStream Method
A stream of CSV data
The name for the tab of the worksheet
Where to generate the output
Turn a CSV string into an Excel Workbook
Syntax
Public Sub GenerateFromCsvStream( _
   ByVal csvStream As Stream, _
   ByVal worksheetName As String, _
   ByVal outputStream As Stream _
) 
Dim instance As ExcelReportsGenerator
Dim csvStream As Stream
Dim worksheetName As String
Dim outputStream As Stream
 
instance.GenerateFromCsvStream(csvStream, worksheetName, outputStream)
public void GenerateFromCsvStream( 
   Stream csvStream,
   string worksheetName,
   Stream outputStream
)
public:
void GenerateFromCsvStream( 
   Stream^ csvStream,
   String^ worksheetName,
   Stream^ outputStream
) 

Parameters

csvStream
A stream of CSV data
worksheetName
The name for the tab of the worksheet
outputStream
Where to generate the output
Example
ExcelReportsGenerator generator = new ExcelReportsGenerator(); //Trial Mode
//ExcelReportsGenerator generator = new ExcelReportsGenerator("place user name here", "place license key here"); //License Mode
 
string csvString = @"FirstName,LastName,Married,NumberOfChildren,Salary,BirthDate
John,Smith,True,3,""$60,000"",12/15/1977
Joe,Jones,False,0,""$30,000"",6/25/1993";
 
File.WriteAllText("ExampleInput.csv", csvString);
 
using (FileStream inputStream = new FileStream("ExampleInput.csv", FileMode.Open, FileAccess.Read))
{
    using (FileStream outputStream = new FileStream("GenerateFromCsvStreamExample.xlsx",FileMode.Create))
    {
        generator.GenerateFromCsvStream(inputStream, "Employees", outputStream);
    }
}
Dim generator As New ExcelReportsGenerator() 'Trial Mode
'Dim generator As New ExcelReportsGenerator("place user name here", "place license key here") 'License Mode
 
Dim csvString As String = "FirstName,LastName,Married,NumberOfChildren,Salary,BirthDate" & ControlChars.CrLf & "John,Smith,True,3,""$60,000"",12/15/1977" & ControlChars.CrLf & "Joe,Jones,False,0,""$30,000"",6/25/1993"
 
File.WriteAllText("ExampleInput.csv", csvString)
 
Using inputStream As New FileStream("ExampleInput.csv", FileMode.Open, FileAccess.Read)
    Using outputStream As New FileStream("GenerateFromCsvStreamExample.xlsx",FileMode.Create)
        generator.GenerateFromCsvStream(inputStream, "Employees", outputStream)
    End Using
End Using
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ExcelReportsGenerator Class
ExcelReportsGenerator Members