|
-
Jul 26th, 2012, 02:17 AM
#1
Thread Starter
New Member
Mojibake characters showing after exporting excel
I am not sure if anyone has encountered this problem. Here are the steps made to replicate the issue.
Steps: 1. Go to the List --> Contact Persons page. 2. Click on the "Export" button to generate .XLS report for the Contact Persons List. 3. Close the .XLS report and navigate to other pages e.g. Contacts List. 4. In the Contacts List, click on "Close" button to REDIRECT back to the "Contact Persons" list page.
Expected: - Page shoud display the Contact Persons List page.
Actual: - A strange page is displayed containing mojibaki characters. Please see image in this url http://i.imgur.com/dIsZc.png
here are the codes to generate the excel using an Active report:
private static void PushContentToHttp(ActiveReport report, MemoryStream msData, string fileName, string url)
{
report.Run();
XlsExport xls = new XlsExport();
xls.DisplayGridLines = true;
xls.AutoRowHeight = true;
xls.Export(report.Document, msData);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.AddHeader("Content-Length", msData.Length.ToString());
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename= \"" + fileName + ".xls\"");
HttpContext.Current.Response.AddHeader("Refresh", "3; url=" + url);
HttpContext.Current.Response.BinaryWrite(msData.ToArray());
HttpContext.Current.Response.End();
}
Any help would be very much appreciated! Thank you so much! :)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|