问题写在代码中
public void CreateExcel(DataSet ds, string FileName)
    {        Microsoft.Office.Interop.Excel.ApplicationClass xlApp = 
             new Microsoft.Office.Interop.Excel.ApplicationClass();
        Microsoft.Office.Interop.Excel.Workbook xlBook = xlApp.Workbooks.Add(true);        System.Reflection.Missing miss = System.Reflection.Missing.Value;        xlApp.Cells[1, 1] = "编号";
        xlApp.Cells[1, 2] = "姓名";
        xlApp.Cells[1, 3] = "单位";
        xlApp.Cells[1, 4] = "时间";
        xlApp.Cells[1, 5] = "内容";        DataTable dt = ds.Tables[0];
        int r = 2;
        foreach (DataRow dr in dt.Rows)
        {
            xlApp.Cells[r, 1] = dr["tid"].ToString();
            xlApp.Cells[r, 2] = dr["tname"].ToString();
            xlApp.Cells[r, 3] = dr["tunit"].ToString();
            xlApp.Cells[r, 4] = dr["ttime"].ToString();
            xlApp.Cells[r, 5] = dr["tcontent"].ToString();
            r++;
        }        xlApp.get_Range(xlApp.Cells[1, 1], xlApp.Cells[r - 1, 1]).ColumnWidth = 5;
        xlApp.get_Range(xlApp.Cells[1, 2], xlApp.Cells[r - 1, 4]).ColumnWidth = 15;        xlApp.get_Range(xlApp.Cells[1, 5], xlApp.Cells[r - 1, 5]).ColumnWidth = 80;
        //这里宽保持80,但导出的文件的内容是一直横过去的,出了单元格的外面
        //怎样才能让他不超出单元格而自动换行呢???        //xlApp.get_Range(xlApp.Cells[1, 5], xlApp.Cells[r - 1, 5]).RowHeight = 50;
        xlApp.Visible = false;        string filename = DateTime.Now.ToString("yyyyMMddhhmmss");        xlBook.SaveAs(Server.MapPath("~/Upload/execl/" + filename + ".xls"), miss, miss, 
            miss, miss, miss,Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
            miss, miss, miss, miss, miss);        xlApp.Workbooks.Close();