0
내가 렌더링하고 reportviewer로 확장하지만 이러한 코드는 이전 파일 확장명으로 확장됩니다. 예를 들어 .xlsx를 사용하여 만들고 싶지만 xls을 만듭니다. 기본 mimeType을 어떻게 바꿀 수 있습니까? 엑셀 2007과 MIME 타입 위reportviewer의 MIME 형식을 어떻게 바꿀 수 있습니까?
protected void ExportExcel_Click(object sender, EventArgs e)
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
string filename;
byte[] bytes = ReportViewer1.LocalReport.Render(
"Excel", null, out mimeType, out encoding,
out extension,
out streamids, out warnings);
filename = string.Format("{0}.{1}", "ExportToExcel", "xls");
Response.ClearHeaders();
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
Response.ContentType = mimeType;
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}