表格没有表头

解决方案 »

  1.   

    去搜下NPOI,这个专门针对导出Excel表格的东西。
    很好用,功能很全,也很灵活。
      

  2.   


            public static void ExportIrregularTable2Excel()
            {
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.Buffer = true;            //设置Http的头信息,编码格式
                System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=result.xls");
                System.Web.HttpContext.Current.Response.ContentType = "application/ms-excel";
                //设置编码
                System.Web.HttpContext.Current.Response.Charset = "GB2312";
                System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
                //写表
                System.Web.HttpContext.Current.Response.Write("技术部项目申请表" + "\t\n");
                System.Web.HttpContext.Current.Response.Write("项目名称:\t" + " \t"+"提出人\t"+" \t\n");
                System.Web.HttpContext.Current.Response.Write("项目要达到的要求" + "\t\n");
                System.Web.HttpContext.Current.Response.Write("\t\n");
                System.Web.HttpContext.Current.Response.Write("\n");
                System.Web.HttpContext.Current.Response.End();
     
            }嗯,我正在尝试在后台把格式化,一个"\t"是一个单元格,"\n"换行
    不过遇见问题了,就是单元格的行合并和列合并的问题,怎么解决呢?
      

  3.   


    我看了下NPOI,是挺不错的,不过类库挺大的,2.7M