我无法打开呈现为xlsx文件的SSRS报告,该报告是通过从SSIS脚本任务调用Reporting Services Web服务ReportExecution2005.asmx?wsdl生成的.但我可以打开由同一方法生成的xls文件.
有人可以告诉我,我需要做些什么才能呈现可用的xlsx文件?
我正在尝试使用脚本任务从SSIS运行Reporting Services报告.我需要将报告呈现为Excel xlsx文件.如果我使用.xls扩展名,我的代码可以工作,我的意思是它确实会产生一个可以在Excel中打开的xls文件.但是如果我将文件扩展名更改为xlsx,我会得到一个无法打开的文件,并产生以下错误."Excel无法打开文件,因为文件格式或文件扩展名无效.验证文件......... .."
在我的代码我正在使用
MimeType = “application/vnd.ms-excel” for the xls file
Run Code Online (Sandbox Code Playgroud)
和
MimeType ="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
对于xlsx文件
我用来运行报告的Web服务是ReportExecution2005.asmx?wsdl(我假设它是正确使用的?)
我在SSIS脚本任务中的代码如下,
var rsClient = new RSExec.ReportExecutionServiceSoapClient();
rsClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password");
rsClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
byte[] result = null;
string reportPath = "filepath/filename";
string format = "EXCEL";
string historyID = null;
string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
string encoding = String.Empty; //"";
string mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; // Excel2010
//string mimeType = "application/vnd.ms-excel"; // EXCEL
string extension = "";
Warning[] warnings = null; …
Run Code Online (Sandbox Code Playgroud)