Test_Tools/ExcelExp.cs
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
using CarlosAg.ExcelXmlWriter;
using System.Web;
namespace Tools
{
/// <summary>
///Excel主处理类
/// </summary>
public class ExcelExp
{
private Workbook _book = new Workbook();
private DataTable _dataTable = null;
private string _title = "";
private Page _page = null;
private List<ExcelColumnCollection> _columnNamesCollection = new List<ExcelColumnCollection>();
private SortedList<string, int> _maxLengthOfField = new SortedList<string, int>();
private bool _isAutoFitWidth = true;
private string _Author = "";
private string _LastAuthor = "";
private string _Company = "";
private string _Version = "11.6408";
/**/
/// <summary>
/// 构造函数
/// </summary>
/// <param name="dt">DataTable形式的数据源</param>
/// <param name="title">Excel显示标题</param>
public ExcelExp(DataTable dt, string title)
{
Page page = (Page)HttpContext.Current.Handler;
if (dt == null)
{
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));
}
}
/**/
/// <summary>
后面还有 337 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
