<input id="filePathHidden" runat="server" type="hidden" />
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server"
Text="Button" onclick="Button1_Click" />
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Aspose.Cells;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string path = Server.MapPath(FileUpload1.FileName);
Workbook workbook = new Workbook();
workbook.Open(FileUpload1.PostedFile.InputStream);
//Get the first worksheet cells collection
Cells cells = workbook.Worksheets[0].Cells;
for (int i = 1; i < cells.MaxDataRow; i++)
{
for (int j = 0; j < cells.MaxDataColumn; j++)
{
Response.Write(cells[i, j].StringValue);
}
}
System.Data.DataTable dt = new DataTable();
dt = cells.ExportDataTable(1, 0, cells.MaxDataRow + 1, cells.MaxDataColumn + 1);
dt.Columns[0].ColumnName = "Question";
dt.Columns[1].ColumnName = "Choice1";
dt.Columns[2].ColumnName = "Choice2";
dt.Columns[3].ColumnName = "Choice3";
dt.Columns[4].ColumnName = "Choice4";
dt.Columns[5].ColumnName = "Answer";
dt.AcceptChanges();
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/default.aspx