title: How to export RDLC report as .xlsx format in asp.net?
body: <p>In rdlc reporting, I want to export rdlc report as excel format 2007 i.e .xlsx format. I have written the following code to get such output. But system produce .xls format. Please help me in this point.</p>
  
  <pre><code>private void PopulateReport(List&lt;OrderDetail&gt; objectList, string datasetName, string reportPath, out string mimeType, out byte[] renderedBytes, decimal fileWidth, decimal fileHeight)
          {
                  LocalReport localReport = new LocalReport();
              localReport.ReportPath = Server.MapPath(reportPath);
                  ReportDataSource reportDataSource = new ReportDataSource(datasetName, objectList);
              localReport.DataSources.Add(reportDataSource);
  
              //localReport.SetParameters(new ReportParameter("pm", "", false));    
              string reportType = "excel";
              mimeType = string.Empty;
              string encoding = string.Empty;
              string fileNameExtension = string.Empty;
              //The DeviceInfo settings should be changed based on the reportType
              string deviceInfo =
  
              "&lt;DeviceInfo&gt;" +
  
              "  &lt;OutputFormat&gt;PDF&lt;/OutputFormat&gt;" +
  
              "  &lt;PageWidth&gt;" + fileWidth + "in&lt;/PageWidth&gt;" +
  
              "  &lt;PageHeight&gt;" + fileHeight + "in&lt;/PageHeight&gt;" +
  
              "  &lt;MarginTop&gt;0.5in&lt;/MarginTop&gt;" +
  
              "  &lt;MarginLeft&gt;1in&lt;/MarginLeft&gt;" +
  
              "  &lt;MarginRight&gt;1in&lt;/MarginRight&gt;" +
  
              "  &lt;MarginBottom&gt;0.5in&lt;/MarginBottom&gt;" +
              "&lt;/DeviceInfo&gt;";
              Warning[] warnings;
              string[] streams;
              //Render the report
              renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
              //Clear the response stream and write the bytes to the outputstream
              //Set content-disposition to "attachment" so that user is prompted to take an action
              //on the file (open or save)
              Response.Clear();
              Response.ContentType = mimeType;
              Response.AddHeader("content-disposition", "attachment; filename=foo." + fileNameExtension);
              Response.BinaryWrite(renderedBytes);
              Response.End();
          }
  </code></pre>