I need to export DataTable to Excel file. Is tehre anyone help me?
I dont want to listview to excel...

Try this:

// TO USE:
            // 1) include COM reference to Microsoft Excel Object library
            // add namespace...
            // 2) using Excel = Microsoft.Office.Interop.Excel;
            private static void Excel_FromDataTable(DataTable dt)
                // Create an Excel object and add workbook...
                Excel.ApplicationClass excel = new Excel.ApplicationClass();
                Excel.Workbook workbook = excel.Application.Workbooks.Add(true); // true for object template???

                // Add column headings...
                int iCol = 0;
                foreach (DataColumn c in dt.Columns)
                    excel.Cells[1, iCol] = c.ColumnName;
                // for each row of data...
                int iRow = 0;
                foreach (DataRow r in dt.Rows)

                    // add each row's cell data...
                    iCol = 0;
                    foreach (DataColumn c in dt.Columns)
                        excel.Cells[iRow + 1, iCol] = r[c.ColumnName];

                // Global missing reference for objects we are not defining...
                object missing = System.Reflection.Missing.Value;

                // If wanting to Save the workbook...
                    Excel.XlFileFormat.xlXMLSpreadsheet, missing, missing,
                    false, false, Excel.XlSaveAsAccessMode.xlNoChange,
                    missing, missing, missing, missing, missing);

                // If wanting to make Excel visible and activate the worksheet...
                excel.Visible = true;
                Excel.Worksheet worksheet = (Excel.Worksheet)excel.ActiveSheet;

                // If wanting excel to shutdown...
Nice SPAM counter!

"Excel.ApplicationClass excel = new Excel.ApplicationClass();"
getting error in the above mentioned line..

"Microsoft.Office.Interop.Excel" has no constructors defined..this is the error message
Can any one help me out..

This question has already been answered. Start a new discussion instead.