本文介绍了导出到Excel数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个GridView,它正在与数据表中的数据绑定,我将从表中过滤数据,然后绑定到Gridview, 如何将数据导出到绑定到gridview的Excel。 请尽快帮助我I Have a GridView, which is getting bind with data from data table and i will filter data from table and then bind to Gridview,How to Export data to Excel which is binded to gridview.Please Help Me ASAPBindRequestDetails(); //dtRequestDetails = dsRequests.Tables["CertificationRequest"]; DataTable dtReport = dtRequestDetails; string[] strColumns = { "RequestID", "RequestStatus", "EmployeeName", "ProjectName", "CertificationName", "PercentageObtained", "PassingPercentage", "ExpectedExamFee", "ActualExamFee", "ReimbursementAmount", "ValidTillDate", "PrimarySkills" }; DataTable reportTable = dtReport.DefaultView.ToTable(dtReport.TableName, false, strColumns); string strFileNameForExport = "Report.xls"; reportTable.Columns["RequestID"].ColumnName = "Request ID"; reportTable.Columns["RequestStatus"].ColumnName = "Request Status"; reportTable.Columns["EmployeeName"].ColumnName = "Employee Name"; reportTable.Columns["ProjectName"].ColumnName = "Project Name"; reportTable.Columns["CertificationName"].ColumnName = "Certification Name"; reportTable.Columns["PercentageObtained"].ColumnName = "Percentage Obtained"; reportTable.Columns["PassingPercentage"].ColumnName = "Passing Percentage"; reportTable.Columns["ExpectedExamFee"].ColumnName = "Expected Exam Fee"; reportTable.Columns["ActualExamFee"].ColumnName = "Actual Exam Fee"; reportTable.Columns["ReimbursementAmount"].ColumnName = "Reimbursement Amount"; reportTable.Columns["ValidTillDate"].ColumnName = "ValidTill Date"; reportTable.Columns["PrimarySkills"].ColumnName = "Primary Skills"; try { OCSCommon.GenerateExcelAndDownload(strFileNameForExport, reportTable); }推荐答案 这篇关于导出到Excel数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-01 05:15