这会用到什么类?
用xmlText可以么?
谢谢告诉小弟下~

解决方案 »

  1.   

    可以啊,使用File.create方法就可以
    数据添加的时候,单元格切换使用'\t'就可以了
      

  2.   

    XSl就是XML文件啊!只不过它的允许的标记是W3C定义的,按照你平时操作XML的方式就可以了
      

  3.   

    //导出Excel表
        public void ExportExcel(string strExcelFileName)
        {
            try
            {
                //设置存放Excel表格的路径
                string templetFilePath = Server.MapPath("../").ToString() + @"Template\";            object objOpt = System.Reflection.Missing.Value;
                Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
                excel.Visible = true;
                _Workbook wkb = excel.Workbooks.Add(objOpt);
                _Worksheet wks = (_Worksheet)wkb.ActiveSheet;            wks.Visible = XlSheetVisibility.xlSheetVisible;            int rowIndex = 1;
                int colIndex = 0;            System.Data.DataTable table = ds.Tables[0];
                foreach (DataColumn col in table.Columns)
                {
                    colIndex++;
                    excel.Cells[1, colIndex] = col.ColumnName;
                }            foreach (DataRow row in table.Rows)
                {
                    rowIndex++;
                    colIndex = 0;
                    foreach (DataColumn col in table.Columns)
                    {
                        colIndex++;
                        excel.Cells[rowIndex, colIndex] = row[col.ColumnName].ToString();
                    }
                }
                wkb.SaveAs(templetFilePath + strExcelFileName, objOpt, null, null, false, false, XlSaveAsAccessMode.xlNoChange, null, null, null, null, null);
                wkb.Close(false, objOpt, objOpt);
                excel.Quit();            //强制代码垃圾回收
                GC.Collect();
                //下载文件
                DownLoadFile(templetFilePath, strExcelFileName);
            }
            catch// (Exception e)
            {
                this.OutputMessage("导出Excel表失败!请检测数据库连接");
            }
        }
        //下载到客户端
        private void DownLoadFile(string _FilePath, string _FileName)
        {
            try
            {
                System.IO.FileStream fs = System.IO.File.OpenRead(_FilePath + _FileName);
                byte[] FileData = new byte[fs.Length];
                fs.Read(FileData, 0, (int)fs.Length);
                Response.Clear();
                Response.AddHeader("Content-Type", "application/ms-excel");
                string FileName = System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(_FileName));
                Response.AddHeader("Content-Disposition", "inline;filename=" + System.Convert.ToChar(34) + FileName + System.Convert.ToChar(34));
                Response.AddHeader("Content-Length", fs.Length.ToString());
                Response.BinaryWrite(FileData);
                fs.Close();
                //删除服务器临时文件
                System.IO.File.Delete(_FilePath + _FileName);
                Response.Flush();
                Response.End();            //return true;
            }
            catch// (Exception ex)
            {
                this.OutputMessage("下载到客户端失败!");
                //return false;
            }
        }
      

  4.   

    楼上的哥哥,误会啊!
    是xsl文件 xml的转换成xhtml的东东不是excel的xls.........呵呵~~~~~~~
      

  5.   

    怎么写xml就这么写xsl。
    xsl就是xml。
      

  6.   

    就是呀,你怎么写的xml文件就怎么写xsl。