How do I export RadDataGridView datas to Excel file with NPOI

3 posts, 0 answers
  1. SarperSozen
    SarperSozen avatar
    10 posts
    Member since:
    Nov 2015

    Posted 31 Jan 2017 Link to this post

    Hello everybody,

    I am learning C# in the software specialist course. I want to get datas from RadGridView and export to Excel file. I managed that get datas from RadGridView like this:

    private bool Save_As_Excel_Format()
    {
        if (Personal.Id <= 0) return true;
     
        foreach (var gridViewRowInfo in GetAllRows(rgv.MasterTemplate))
        {
            var dataRow = (GridViewDataRowInfo) gridViewRowInfo;
     
            foreach (GridViewCellInfo cell in dataRow.Cells)
            {
                MessageBox.Show(cell.Value.ToString());
            }
    }
        return true;
    }
     
    public List<GridViewRowInfo> GetAllRows(GridViewTemplate template)
    {
        var allRows = new List<GridViewRowInfo>();
        allRows.AddRange(template.Rows);
        foreach (var childTemplate in template.Templates)
        {
            var childRows = this.GetAllRows(childTemplate);
            allRows.AddRange(childRows);
        }
        return allRows;
    }

     

    But I do not know how I export to Excel with using NPOI library.

     

  2. Dimitar
    Admin
    Dimitar avatar
    2949 posts

    Posted 31 Jan 2017 Link to this post

    Hi Mehmet,

    This is supported out of the box. Detailed information is available here: Export to Excel.

    In addition, we have our own library for editing excel files: RadSpreadProcessing.

    I hope this information is useful. Let me know if you need further assistance.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. SarperSozen
    SarperSozen avatar
    10 posts
    Member since:
    Nov 2015

    Posted 31 Jan 2017 Link to this post

    Man does not expect it to be that easy.

    Thank you very much. Anymore, When I graduate, I should get one of this one more.

    Kind regards,

    Mehmet.

Back to Top