简体   繁体   中英

SQL Reporting Services and Excel

The basic setup is that I have a web application that calls SQL Reporting Services to run reports. The reports have the option of returning in PDF or Excel format. The code in the background runs the report, gets the results and writes it out using httpResponse.BinaryWrite(). Most of the reports work fine. IE recognizes the excel file, fires up excel and opens the worksheet. HOWEVER, some reports don't cause excel to start. Some end up in some kind of excel widget that is running within IE. This is unsatisfactory.

The code to run the reports and display them is totally generic and used by all of the reports. So I'm thinking it has something to do with the report....but I don't know what that might be. At this point I'm really grasping in the dark.

It only happens when using Excel 2003. Excel 2007 works fine. I'm currently unable to get a development machine that is running Excel 2003 so it has been a bear to try and debug.

Any ideas?

Dammit! I should have known, as this has bit me in the past. Will answer here in case it helps anyone else. The problem was my report name containing characters that don't play nice in file names. I build a temporary file name using the name of the report. In this case my report title contains "Race/Ethnicity", so the name of the file that I'm streaming back contains a "/".

Excel 2007 is sophisticated enough to handle it. Excel 2003 seems to have problems. Possibly the interaction between IE and Excel 2003/2007. But both of my test machines are using IE7.

也许您可以尝试使用.NET代码启动excel,然后在这种情况下打开生成的excel文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM