Excel for ASP.NET

Posted by: przemekmisiuda on 10 September 2017, 11:41 am EST

  • Posted 10 September 2017, 11:41 am EST


    I need to evaluate your product "Excel for ASP.NET" and compare it with another commercial products, but:
    - Live Demo from this site http://www.componentone.com/SuperProducts/Excel/ doesn't work
    - Samples from Trial version (Control Explorer Sample for ComponentOne Studio for ASP.NET Wijmo) don't work: Unable to load 'ControlExplorer.PageStateAdapter type (VS 2008)

    < adapter controlType="System.Web.UI.Page" adapterType="ControlExplorer.PageStateAdapter" />

    I need a simple solution (like Aspose GridWeb) for loading Excel into ASP.NET control, editing it and saving it into Excel. Can you send me simple working project with such example?

    BTW. your samples solutions from trail verion are too complicated => error prone.

    If I'm not able to run your samples , I will choose Aspose product (their samples works perfectly!)
  • Replied 10 September 2017, 11:41 am EST

    There is no direct method to import Excel data into the C1GridView; however, you can still achieve this in custom code. Basically, you can use C1Excel to load the spreadsheet, copy the spreadsheet data into a DataTable, and then bind the C1GridView to the new DataTable. Below is some code to handle this:

    protected void Page_Load(object sender, EventArgs e)
    // bind data
    C1GridView1.DataSource = GetData();

    // get spreadsheet and load it into C1XLBook
    public C1XLBook LoadSpreadsheet(string relPath)
    C1XLBook book = new C1XLBook();
    book.Load(relPath, FileFormat.OpenXml, true);
    return book;

    // create data from Excel spreadsheet
    public DataTable GetData()
    C1XLBook book = LoadSpreadsheet(Server.MapPath(@"~/ExcelDocuments/Test.xlsx"));
    XLSheet sheet = book.Sheets[0];

    DataTable dt = new DataTable(sheet.Name);

    // create columns based on first row in spreadsheet
    for (int i = 0; i < sheet.Columns.Count; i++)
    dt.Columns.Add(sheet[0, i].Text, typeof(string));

    // load spreadsheet rows into DataTable
    for (int row = 1; row < sheet.Rows.Count; row++)
    DataRow dataRow = dt.NewRow();

    for (int col = 0; col < sheet.Columns.Count; col++)
    var val = sheet.GetCell(row, col).Text;
    dataRow[col] = val;


    return dt;

    Regarding the sample error, I couldn't reproduce this issue. Can you explain how to reproduce the issue?

    I will also pass your suggestion about the samples being too complicated to our developers and managers.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels