J
J-Bal
Guest
I am using VS 2019 and attempting to export (render) an rdlc report as .docx. When I try to open it I get an error that the content is corrupt and unreadable. How to solve this? Here is my code:
byte[] bytesret = ReportViewer1.LocalReport.Render("WORDOPENXML", null, out mimeType, out encoding, out fileNameExtension, out streamids, out warnings);
Response.Buffer = false;
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/ms-word" //***Note: also tried mimeType
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.AddHeader("content-disposition", "attachment; filename=" + fileName); //attachement;
Response.BinaryWrite(bytesret); // create the file
Response.Flush();
Continue reading...
byte[] bytesret = ReportViewer1.LocalReport.Render("WORDOPENXML", null, out mimeType, out encoding, out fileNameExtension, out streamids, out warnings);
Response.Buffer = false;
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/ms-word" //***Note: also tried mimeType
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.AddHeader("content-disposition", "attachment; filename=" + fileName); //attachement;
Response.BinaryWrite(bytesret); // create the file
Response.Flush();
Continue reading...