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.Collections.Generic;
using System.Drawing;
/// <summary>
/// 用于设置打印输出的Excel配置文件
/// </summary>
public class ExcelConfig
{
private object _data = null;
private bool _isGridView = true;
private bool _isDataTable = false;
private bool _isfromtemplate = false;
private string _exportexcelfilename = "";
private string _exportexcelfilepath = "";
private string _templatefilename = "";
private string _templatefilepath = "";
private string _sheetname = null;
private string[] _headertext = null;
private string[,] _contenttext = null;
private string _headertitle = "";
private bool _hasmacro = false;
private string _macro = "";
public ExcelConfig()
{
this._data = null;
this._isGridView = false;
this._isDataTable = false;
initConfig();
}
public ExcelConfig(DataTable dt)
{
this._data = dt;
this._isGridView = false;
this._isDataTable = true;
initConfig();
}
public ExcelConfig(GridView gv)
{
this._data = gv;
this._isGridView = true;
this._isDataTable = false;
initConfig();
}
private void initConfig()
{
this._exportexcelfilename = DateTime.Now.ToString("yyyymmddhhmmss") + ".xls";//默认保存的文件名根据系统时间自动生成
this._exportexcelfilepath = "~/xls/"; //默认文件输出的路径
this._templatefilepath = "~/A