Exemple #1
0
 /**/
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dt">List(数据源)</param>
 /// <param name="title">List(Excel显示标题)</param>
 public ExcelMoreBook(List<DataTable> dt, List<string> title)
 {
     Page page = (Page)HttpContext.Current.Handler;
     if (dt.Count == 0)
     {
         throw new Exception("数据源为空");
     }
     _dataTable = dt;
     _title = title;
     _page = page;
 }
 /**/
 /// <summary>
 /// 以GridView的Head为标题
 /// </summary>
 /// <param name="row">GridView表头行对象</param>
 public void SetColumnNameFromGridViewHeadRow(GridViewRow row)
 {
     ExcelColumnCollection excelcols = new ExcelColumnCollection();
     _columnNamesCollection.Add(excelcols);
     foreach (TableCell cell in row.Cells)
     {
         excelcols.Add(new ExcelColumn(cell.Text));
     }
 }
Exemple #2
0
        /**/
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dt">List(数据源)</param>
        /// <param name="title">List(Excel显示标题)</param>
        public ExcelMoreBook(List <DataTable> dt, List <string> title)
        {
            Page page = (Page)HttpContext.Current.Handler;

            if (dt.Count == 0)
            {
                throw new Exception("数据源为空");
            }
            _dataTable = dt;
            _title     = title;
            _page      = page;
        }

        /**/
        /// <summary>
        /// 以GridView的Head为标题
        /// </summary>
        /// <param name="row">GridView表头行对象</param>
        public void SetColumnNameFromGridViewHeadRow(GridViewRow row)
        {
            ExcelColumnCollection excelcols = new ExcelColumnCollection();

            _columnNamesCollection.Add(excelcols);
            foreach (TableCell cell in row.Cells)
            {
                excelcols.Add(new ExcelColumn(cell.Text));
            }
        }