I'm using 'ExcelDataReader' to read in an Excel file, I want to display the file on screen.
protected void Page_Load(object sender, EventArgs e)
{
string filePath = @"C:\WORK\BoireannSVN\trunk\VS\CRCConnect\Spreadsheet\Spreadsheet.xlsx";
FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
excelReader.IsFirstRowAsColumnNames = true;
DataSet result = excelReader.AsDataSet();
while (excelReader.Read())
{
Label x = new Label();
x.Text = result.Tables[0].Rows[0].ItemArray[0].ToString();
uploadExcel.Controls.Add(x);
excelReader.GetInt32(0);
}
excelReader.Close();
}
I've added in the
Label x = new Label();
x.Text = result.Tables[0].Rows[0].ItemArray[0].ToString();
Attempting to get the excel sheet to display on screen, although I'm having no luck with this. I think it is something like
table1.Columns.Add;
table1.Rows.Add;
but can't seem to get it going, any help much appreciated.