Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
830
Excelexporter saves the Excel file properly but when i download the saved file to the brwoser it shows up with special characters
posted

Hi, I have the following code that saves a grid content into an excel file:

var book = new Infragistics.Documents.Excel.Workbook();

this.excelExporter.DownloadName = fileName;
this.excelExporter.ExportMode = ExportMode.Custom;
this.excelExporter.DataExportMode = DataExportMode.DataInGridOnly;
this.excelExporter.WorkbookFormat = Infragistics.Documents.Excel.WorkbookFormat.Excel97To2003;
this.excelExporter.Export(wdg, book);

book.Save(urlInternal);

Then i send the file to the browser using the following code:

Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("content-disposition", "attachment; filename=" + fileName);
Response.Flush();
Response.TransmitFile(urlInternal);
Response.End();

However after file download it shows up with special characters like the following: 

�B�a�=�=���:'8X@�"��1���Calibri1���Calibri1���Calibri1���Calibri1���Calibri1���Calibri1���Calibri1�

Do you know if i should use some other code to allow file download without altering its content

FYI, when i use Excel to open the file that is saved on the IIS server, the file opens properly.

Thank you :)

  • 49378
    posted

    Hello Rtutus,

    Thank you for posting in the community.

    I have tested this scenario with the latest Service Release available for NetAdvantage - 13.1.20131.2069 and so far, using the code provided the grid is successfully being exported as desired. Attached is my test sample for your consideration. Please feel free to modify this application as required in order to illustrate the behavior and allow me to examine the matter further.

    Do not hesitate to contact me with any updates or questions.

    WDGCustomExport.zip