Click here to Skip to main content
15,886,807 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to render the RDLC report to .docx not as doc. I have tried out the following code but it didnt work. So please help me to solve the issue.
C#
var report = new LocalReport();
RvQpTemplate.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource());
RvQpTemplate.DataBind();

Byte[] mybytes = RvQpTemplate.LocalReport.Render("WORD", null,
                out extension, out encoding,
                out mimeType, out streams, out warnings);
Response.ClearHeaders();
Response.ClearContent();
Response.Buffer = true;
Response.Clear();
Response.ContentType = contentType;
Response.AddHeader("Content-Disposition", "attachment; filename="+test.docx);
Response.BinaryWrite(mybytes);
Response.Flush();
Response.Close();
Response.End();
Posted
Updated 12-Dec-14 1:26am
v2

1 solution

Call render method with WORDOPENXML instead of WORD
 
Share this answer
 
Comments
Member 10319864 15-Dec-14 0:03am    
When i use the WORDOPENXML i am getting this error Specified argument was out of the range of valid values. Parameter name: format. so please suggest me other solutions. Thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900