我在尋找如何將數據網格(不DataGridView中)導出到Excel中我的工作VS 2003的winform。我在找上了網,但是沒有結果,我找到的解決方案是隻是(datagridview的VS 2010 ...(ASP ..) 請幫我 THANK YOU出口的DataGrid到Excel C#的winform
這是我到目前爲止有:
lblMessage.Text = "";
// Export all the details
try
{
// Get the datatable to export
DataTable dtEmployee = dsEmployee.Tables["Employee"].Copy();
// Export all the details to Excel
RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Win");
objExport.ExportDetails(dtEmployee, Export.ExportFormat.Excel, "C:\\EmployeesInfo.xls");
lblMessage.Text = "Successfully exported to C:\\EmployeesInfo.xls";
}
catch(Exception Ex)
{
lblMessage.Text = Ex.Message;
}
你想要做的代碼? –
你有沒有試過這個http://stackoverflow.com/questions/373925/c-sharp-winforms-app-export-dataset-to-excel?rq=1 –
是的,我想通過代碼:) – Meryem