I have installed DocumentFormat.OpenXml (ver 2.5.5631.0) from nugetpackage manager in VS2010. I can see the reference to the DLL. I have created a package folder. But when I am trying to execute method:
public override void Render(LocalReport report)
{
this.SetUpParameters(report);
byte[] renderedReport = report.Render("EXCELOPENXML");
this.target.UpdateRenderedReportContent(renderedReport);
}
I am getting this error:
Specified argument was out of the range of valid values. Parameter name: format
When I am using
report.Render("EXCEL");
I am not getting any error. I have to use EXCELOPENXML to generate xlsx excel.
What version of Microsoft.ReportViewer.WinForms
are you referencing? If it's less than 11.0, that's probably your problem.
Incidentally, Visual Studio (2013) declined to show me version 11.0 as an option from the Add Reference dialog. I don't understand why. I had to browse to the the assembly in the GAC:
C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WinForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WinForms.DLL
Once you do that, run the following method. You should see EXCELOPENXML as an option now.
new LocalReport().ListRenderingExtensions();