Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将报表查看器内容写入新工作表中的现有excel文件_C#_Asp.net_Excel - Fatal编程技术网

C# 将报表查看器内容写入新工作表中的现有excel文件

C# 将报表查看器内容写入新工作表中的现有excel文件,c#,asp.net,excel,C#,Asp.net,Excel,我想将报表查看器内容导出到excel工作表中。下面的代码正在成功写入,但创建了一个新的excel文件。但是,我希望打开现有的excel工作表,并将报表查看器内容放入新的工作表中 byte[] bytes = viewer.LocalReport.Render("Excel", null, out mimeType, out encoding, out extension, out streamIds, out warnings); System.IO.FileStream fs = new Sy

我想将报表查看器内容导出到excel工作表中。下面的代码正在成功写入,但创建了一个新的excel文件。但是,我希望打开现有的excel工作表,并将报表查看器内容放入新的工作表中

byte[] bytes = viewer.LocalReport.Render("Excel", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
System.IO.FileStream fs = new System.IO.FileStream(@"d:\output.xls", System.IO.FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.close();

如果没有
viewer.LocalReport.Render()
方法的代码,您将很难获得帮助。这个方法在做什么?它是如何做到的?它是使用某种第三方库(如OpenXML)还是创建HTML响应?查看器是Microsoft.Reporting.WebForms.ReportViewer对象,我在其中加载rdlc报告并在rdlc报告中设置数据源<代码>Microsoft.Reporting.WebForms.ReportViewer=新建ReportViewer();viewer.ProcessingMode=ProcessingMode.Local;viewer.LocalReport.ReportPath=Server.MapPath(“~/Report/R3PnLProject.rdlc”);viewer.LocalReport.DataSources.Add(resIncme)如果没有
viewer.LocalReport.Render()方法的代码,将很难为您提供帮助。这个方法在做什么?它是如何做到的?它是使用某种第三方库(如OpenXML)还是创建HTML响应?查看器是Microsoft.Reporting.WebForms.ReportViewer对象,我在其中加载rdlc报告并在rdlc报告中设置数据源<代码>Microsoft.Reporting.WebForms.ReportViewer=新建ReportViewer();viewer.ProcessingMode=ProcessingMode.Local;viewer.LocalReport.ReportPath=Server.MapPath(“~/Report/R3PnLProject.rdlc”);viewer.LocalReport.DataSources.Add(resIncme)