This is a migrated thread and some comments may be shown as answers.

How do I export RadDataGridView datas to Excel file with NPOI

2 Answers 184 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SarperSozen
Top achievements
Rank 1
SarperSozen asked on 31 Jan 2017, 08:26 AM

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 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 31 Jan 2017, 11:13 AM
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.
0
SarperSozen
Top achievements
Rank 1
answered on 31 Jan 2017, 01:06 PM

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.

Tags
GridView
Asked by
SarperSozen
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
SarperSozen
Top achievements
Rank 1
Share this question
or