예제 #1
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     string reportFormater = @"SELECT [ip] as 终端IP
       ,[mac] as 终端MAC
       ,[address] as 终端地址
       ,[onlineseconds] as 在线时长
       ,[name] as 终端名称
       ,(select name from common_weather_city where code=[citycode]) as 所在城市
       ,[storeno] as 门店编号
       ,[storename] as 门店名称
       ,[storephone] as 门店电话
       ,[storeprefix] as 门店前缀
       FROM [yuantuo_terminals]";
     if (this.ddlGroups.SelectedIndex > 0)
         reportFormater += " where groupid = " + this.ddlGroups.SelectedValue.Trim();
     reportFormater += " order by citycode,id";
     //20121019目录销售单据传递样表
     string title = "终端列表";
     string path = Server.MapPath("~/YuanTuo/ReportFiles/终端列表.xls");
     DataTable dt = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(reportFormater.Replace("\r\n", ""), "tmp");
     FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
     excel.IsReplaceReport = true;
     excel.Title = title;
     excel.HeaderWidth = new int[] { 20, 20, 30, 10, 20, 20, 10, 10, 10,10 };
     // excel.HasHeader = false;
     // excel.HasFooter = false;
     //excel.GetExcelReport();
     FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
 }
예제 #2
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        string reportFormater = @"SELECT [no] as 产品编号
          ,[name] as 产品名称
          ,[price] as 产品价格
          ,case [status] when 1 then '上架中' else '已下架' end as 产品状态
          ,[pinpai] as 品牌
          ,[guige] as 规格
          ,[chandi] as 场地
          ,[getproductdays] as 取货天数
          ,[seetimes] as 浏览次数
          FROM [yuantuo_product_info]";
        if (this.ddlProductType.SelectedIndex > 0)
            reportFormater += " where producttypeid = " + this.ddlProductType.SelectedValue.Trim();

        //20121019目录销售单据传递样表
        string title = "产品列表";
        string path = Server.MapPath("~/YuanTuo/ReportFiles/产品列表.xls");
        DataTable dt = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(reportFormater.Replace("\r\n", ""), "tmp");
        FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
        excel.IsReplaceReport = true;
        excel.Title = title;
        excel.HeaderWidth = new int[] { 10, 40, 10, 10, 20, 20, 20, 10, 10 };
           // excel.HasHeader = false;
           // excel.HasFooter = false;
        //excel.GetExcelReport();
        FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
    }
예제 #3
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        string reportFormater = @"SELECT [ip] as 终端IP
      ,[mac] as 终端MAC
      ,[address] as 终端地址
      ,[onlineseconds] as 在线时长
      ,[name] as 终端名称
      ,(select name from common_weather_city where code=[citycode]) as 所在城市
      ,[storeno] as 门店编号
      ,[storename] as 门店名称
      ,[storephone] as 门店电话
      ,[storeprefix] as 门店前缀
  FROM [yuantuo_terminals]";

        if (this.ddlGroups.SelectedIndex > 0)
        {
            reportFormater += " where groupid = " + this.ddlGroups.SelectedValue.Trim();
        }
        reportFormater += " order by citycode,id";
        //20121019目录销售单据传递样表
        string    title = "终端列表";
        string    path  = Server.MapPath("~/YuanTuo/ReportFiles/终端列表.xls");
        DataTable dt    = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(reportFormater.Replace("\r\n", ""), "tmp");

        FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
        excel.IsReplaceReport = true;
        excel.Title           = title;
        excel.HeaderWidth     = new int[] { 20, 20, 30, 10, 20, 20, 10, 10, 10, 10 };
        // excel.HasHeader = false;
        // excel.HasFooter = false;
        //excel.GetExcelReport();
        FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
    }
예제 #4
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        string reportFormater = @"SELECT [no] as 产品编号
      ,[name] as 产品名称
      ,[price] as 产品价格
      ,case [status] when 1 then '上架中' else '已下架' end as 产品状态
      ,[pinpai] as 品牌
      ,[guige] as 规格
      ,[chandi] as 场地
      ,[getproductdays] as 取货天数
      ,[seetimes] as 浏览次数
  FROM [yuantuo_product_info]";

        if (this.ddlProductType.SelectedIndex > 0)
        {
            reportFormater += " where producttypeid = " + this.ddlProductType.SelectedValue.Trim();
        }

        //20121019目录销售单据传递样表
        string    title = "产品列表";
        string    path  = Server.MapPath("~/YuanTuo/ReportFiles/产品列表.xls");
        DataTable dt    = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(reportFormater.Replace("\r\n", ""), "tmp");

        FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
        excel.IsReplaceReport = true;
        excel.Title           = title;
        excel.HeaderWidth     = new int[] { 10, 40, 10, 10, 20, 20, 20, 10, 10 };
        // excel.HasHeader = false;
        // excel.HasFooter = false;
        //excel.GetExcelReport();
        FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
    }
예제 #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        /*

         */

        string reportFormater = @" SELECT convert(varchar, a.orderdate, 112) as 订购日期,
        convert(varchar, a.orderdate, 108) as 订购时间
         ,a.orderid as 单据号
        ,(select storeno from yuantuo_terminals c where c.id=terminalid)as 网点编码
        ,(select storename from yuantuo_terminals c where c.id=terminalid) as 网点名称
        ,b.no as 商品编码
        ,b.name as 商品名称
        ,a.num as 配送数量
        ,a.mobile as 备注
         from yuantuo_terminal_orders a left join  yuantuo_product_info b on a.productid =b.id";
        //20121019目录销售单据传递样表
        string title="20121019目录销售单据传递样表";
        string path = Server.MapPath("~/YuanTuo/ReportFiles/20121019目录销售单据传递样表.xls");
        DataTable dt=FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(reportFormater.Replace("\r\n",""),"tmp");
        FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
        excel.Title = title;
        excel.HeaderWidth = new int[] { 10,10,20,10,30,10,40,10,10};
        excel.HasHeader = false;
        excel.HasFooter = false;
        //excel.GetExcelReport();
        FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
    }
예제 #6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        /*
         *
         *
         *
         */

        string reportFormater = @" SELECT convert(varchar, a.orderdate, 112) as 订购日期,
convert(varchar, a.orderdate, 108) as 订购时间
 ,a.orderid as 单据号
,(select storeno from yuantuo_terminals c where c.id=terminalid)as 网点编码
,(select storename from yuantuo_terminals c where c.id=terminalid) as 网点名称
,b.no as 商品编码
,b.name as 商品名称
,a.num as 配送数量
,a.mobile as 备注
 from yuantuo_terminal_orders a left join  yuantuo_product_info b on a.productid =b.id";
        //20121019目录销售单据传递样表
        string    title = "20121019目录销售单据传递样表";
        string    path  = Server.MapPath("~/YuanTuo/ReportFiles/20121019目录销售单据传递样表.xls");
        DataTable dt    = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(reportFormater.Replace("\r\n", ""), "tmp");

        FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
        excel.Title       = title;
        excel.HeaderWidth = new int[] { 10, 10, 20, 10, 30, 10, 40, 10, 10 };
        excel.HasHeader   = false;
        excel.HasFooter   = false;
        //excel.GetExcelReport();
        FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
    }
예제 #7
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     string title = "测试excel";
     string path = Server.MapPath("~/YuanTuo/ReportFiles/测试excel.xls");
     DataTable dt = new DataTable();
     dt.Columns.Add("name");
     dt.Columns.Add("sex");
     for (int i = 0; i < 20; i++)
     {
         dt.Rows.Add(new string[] {"name"+i.ToString(),"sex"+i.ToString() });
     }
     FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
     excel.IsReplaceReport = true;
     excel.Title = title;
        // excel.HeaderWidth = new int[] { 10, 40, 10, 10, 20, 20, 20, 10, 10 };
     // excel.HasHeader = false;
     // excel.HasFooter = false;
     //excel.GetExcelReport();
     FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
 }
예제 #8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string    title = "测试excel";
        string    path  = Server.MapPath("~/YuanTuo/ReportFiles/测试excel.xls");
        DataTable dt    = new DataTable();

        dt.Columns.Add("name");
        dt.Columns.Add("sex");
        for (int i = 0; i < 20; i++)
        {
            dt.Rows.Add(new string[] { "name" + i.ToString(), "sex" + i.ToString() });
        }
        FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
        excel.IsReplaceReport = true;
        excel.Title           = title;
        // excel.HeaderWidth = new int[] { 10, 40, 10, 10, 20, 20, 20, 10, 10 };
        // excel.HasHeader = false;
        // excel.HasFooter = false;
        //excel.GetExcelReport();
        FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
    }
예제 #9
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     DataTable dt = this.Search();
     if (dt != null)
     {
         string title = "目录销售单据传递样表";
         string path = Server.MapPath("~/YuanTuo/ReportFiles/目录销售单据传递样表.xls");
         FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
         excel.IsReplaceReport = true;
         excel.Title = title;
         excel.HeaderWidth =new int[]{ 10,10,20,10,30,10,40,10,10};
         // excel.HasHeader = false;
         // excel.HasFooter = false;
         //excel.GetExcelReport();
         FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
     }
     else
     {
         WebTools.Alert("查询出错!");
     }
 }
예제 #10
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        DataTable dt = this.Search();

        if (dt != null)
        {
            string title = "目录销售单据传递样表";
            string path  = Server.MapPath("~/YuanTuo/ReportFiles/目录销售单据传递样表.xls");
            FT.Commons.Com.Excels.ListExcel excel = new FT.Commons.Com.Excels.ListExcel(path, dt);
            excel.IsReplaceReport = true;
            excel.Title           = title;
            excel.HeaderWidth     = new int[] { 10, 10, 20, 10, 30, 10, 40, 10, 10 };
            // excel.HasHeader = false;
            // excel.HasFooter = false;
            //excel.GetExcelReport();
            FT.Web.Tools.WebTools.ExportExcelReport(title + ".xls", excel);
        }
        else
        {
            WebTools.Alert("查询出错!");
        }
    }
예제 #11
0
 /// <summary>
 /// ListExcel��������reportname��excel����
 /// </summary>
 /// <param name="reportname">�������ִ�xls��׺</param>
 /// <param name="listExcel">ListExcel</param>
 public static void ExportExcelReport(string reportname,ListExcel listExcel)
 {
     System.Web.HttpContext.Current.Response.Clear();
     System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
     System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(reportname));
     System.Web.HttpContext.Current.Response.ContentType = "application/ms-excel";
     string filename = listExcel.GetExcelReport();
     FileInfo file = new FileInfo(filename);
     System.Web.HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());//���ͷ�ļ���ָ���ļ��Ĵ�С�����������ʾ�ļ����ص��ٶ�
     System.Web.HttpContext.Current.Response.WriteFile(file.FullName);// ���ļ������͵��ͻ���
     System.Web.HttpContext.Current.Response.End();
 }
예제 #12
0
 private void Export()
 {
     DataTable dt = this.GetTableFromGrid();
     string path = FileDialogHelper.SaveExcel(this.GetTitle()+".xls");
         if (path != null && path != string.Empty)
         {
             if (File.Exists(path))
                 File.Delete(path);
             ListExcel ls = new ListExcel(path, dt);
             ls.Title = this.GetTitle();
             ls.GetExcelReport();
             this.Cursor = Cursors.WaitCursor;
             MessageBoxHelper.Show("�����ɹ���");
             this.Cursor = Cursors.Default;
         }
 }
예제 #13
0
 private void ExportExcel(DataTable dt,int[] headerWidth)
 {
     if (dt != null && dt.Rows.Count > 0)
     {
         string title = this.GetExportTitle();
         string path = FileDialogHelper.SaveExcel(title+".xls");
         if (path != null && path != string.Empty)
         {
             if (File.Exists(path))
                 File.Delete(path);
             ListExcel ls = new ListExcel(path, dt);
             ls.Title = title;
             ls.HeaderWidth = headerWidth;
             ls.GetExcelReport();
             this.Cursor = Cursors.WaitCursor;
             MessageBoxHelper.Show("�����ɹ���");
             this.Cursor = Cursors.Default;
         }
     }
     else
     {
         MessageBoxHelper.Show("û���ҵ��ɵ��������ݣ�");
     }
 }