2017-07-19 48 views
-1

我能够在最后一行获取字节。我必须将其转换为.doc文件并下载它。如何将字节转换为doc文件并使用C下载它#

irsc = new CustomReportCredentials(ReportServerUserName, ReportServerPassword, ReportServerDomain); 
ReportViewer1.ServerReport.ReportServerCredentials = irsc; 
ReportViewer1.ServerReport.ReportServerUrl = rptUrl; 
ReportViewer1.ServerReport.ReportPath = "/" + ReportFolder + "/" + _reportName; 
ReportViewer1.ServerReport.SetParameters(parameters); 
ReportViewer1.ServerReport.Refresh(); 
bytes = ReportViewer1.ServerReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); 
+1

请妥善格式化您的问题 – WhatsThePoint

+0

如果你的意图是使从服务器端接收文件的响应,然后将文档作为字节[]是非常好的。你可以直接向客户端回应byte []。只需要指定mimeType,文件名等。 – derloopkat

回答

0

您可以使用:

File.WriteAllBytes("Foo.txt", arrBytes); // Requires System.IO 

如果你有一个枚举,而不是一个数组,你可以使用:

File.WriteAllBytes("Foo.txt", arrBytes.ToArray()); // Requires System.Linq 
相关问题