2012-07-06 69 views
1

我有SSRS报告,我想导出为Excel格式。我能够这样做,但在保存成功后打开一个特定的报告有一个错误的文件丢失(CSS )。 ? 可能是什么可能出现的问题和解决方案,我只是在一个报告中。其余正在fine.This卡是我使用的代码:导出到SSRS报告excel中的错误

Response.Clear(); 
      Response.ClearHeaders(); 
      Response.Charset = ""; 
      Response.ContentType = "Application/vnd.xls"; 
      Response.Cache.SetCacheability(HttpCacheability.NoCache); 

      Response.AddHeader("content-disposition", "attachment;filename=SkillwiseHeadCount.xls"); 
      Response.AddHeader("Cache-Control", "max-age=0"); 
      Response.BinaryWrite(result); 
      Response.End(); 

回答

0

对我来说,下面的工作就一个类似的项目:

Response.ContentType = "text/csv"; 
string attachment = "attachment;filename=Report_" + DateTime.Now.ToString() + ".csv"; 
Response.AddHeader("content-disposition", attachment); 
Response.AddHeader("Pragma", "no-cache"); 
Response.AddHeader("Expires", "0"); 

我用了一个DataReader。