在开发过程中吸取了多位作者的帖子精华,完成了本人B/S模式下的报表开发工作特此感谢,以下是总结出的类源代码与大家分享。 using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; // using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; /**/ /// <summary>/// Summary description for ProcessExcel/// </summary> public class ProcessExcel ... { private Excel.ApplicationClass m_oExcelApp; private Excel.Workbooks m_oBooks; private Excel._Workbook m_oBook; public Excel._Worksheet m_oSheet; private object m_oMissing; private string m_sReportTemplate; private int m_nReportIndex; private Excel.Range m_oRange; public string ReportTemplate ...{ get ...{ return m_sReportTemplate; } set ...{ m_sReportTemplate = value;} } public int ReportIndex ...{ get ...{ return m_nReportIndex; } set ...{ m_nReportIndex = value;} }// public int WorkSheetCount { get { return m_oBook.Sheets.Count; } } public string CachFile; public ProcessExcel() ...{ m_oExcelApp = null; m_oBooks = null; m_oBook = null; m_oSheet = null; m_oRange = null; m_oMissing = System.Reflection.Missing.Value ; ReportIndex = 1; } setTemplate#region setTemplate public void setTemplate(string source) ...{ this.ReportTemplate=source; } #endregion openExcel#region openExcel public bool OpenExcel() ...{ CachFile=null;