В отчетах rdlc я хочу экспортировать отчет rdlc как формат Excel формата i.e .xlsx. Для получения такого вывода я написал следующий код. Но система производит формат .xls. Пожалуйста, помогите мне в этом вопросе.Как экспортировать отчет RDLC в формате .xlsx в asp.net?
private void PopulateReport(List<OrderDetail> 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 =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>" + fileWidth + "in</PageWidth>" +
" <PageHeight>" + fileHeight + "in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>1in</MarginLeft>" +
" <MarginRight>1in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
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();
}
Я добавил, но это не сработало –