Hi Sudheer
I have a very similar problem. I have create a
page with a warp from this i trigger a link to a new windows that
dowmloads a file using the exportexcel or Response.BinaryWrite.
Everything work really nice in my local computer using IE7 and visual
studio. When I deploy the application to the server it only work fine
with IE6 but not with IE7 .IE7 closes the new window without showing
any error message.
Is infragistic not compatible with IE7 for exporting grids to excel and pdf????? Have you some answer
Have you found a reason for that???? Please help.. I need that as soon as possible. Thanks Sudheer. Below my code:
if (contentReportDs != null)
{
uwgExportReport.DataSource = contentReportDs;
switch (Convert.ToInt32(Enum.Parse(outputFormatReceived, outputFormat)))
{
case 0: // CSV file
if (this.loadPlugin(outputFormat, ref aMessage))
{
Panel csvPanel = ((Panel)this.plugin.generate(this.wpDownloadReport, contentReportDs));
Label csvLabel = new Label();
for(int i=0; i<csvPanel.Controls.Count;i++)
if (csvPanel.Controls[i] is Label)
csvLabel = csvPanel.Controls[i] as Label;
string csvContentToShow = csvLabel.Text;
csvContentToShow = csvContentToShow.Replace("<br />", "" + '\n');
byte[ bytFile = System.Text.Encoding.UTF8.GetBytes(csvContentToShow);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
// If you write,
// Response.Write(bytFile1);
// then you will get only 13 byte in bytFile.
Response.BinaryWrite(bytFile);
Response.End();
}
break;
case 2: // XLS
uwgExportReport.DataBind();
uwgReportExpXls.ExcelStartRow = reportParamValueList.Count + 6;
this.uwgReportExpXls.DownloadName = fileName + ".XLS";
this.uwgReportExpXls.Export(uwgExportReport);
break;
case 3://CSV
if (this.loadPlugin(outputFormat, ref aMessage))
{
Panel csvPanel = ((Panel)this.plugin.generate(this.wpDownloadReport, contentReportDs));
Label csvLabel = new Label();
for (int i = 0; i < csvPanel.Controls.Count; i++)
if (csvPanel.Controls[i] is Label)
csvLabel = csvPanel.Controls[i] as Label;
string csvContentToShow = csvLabel.Text;
csvContentToShow = csvContentToShow.Replace("<br />", "" + '\n');
csvContentToShow = csvContentToShow.Replace("<", "" + '<');
csvContentToShow = csvContentToShow.Replace(">", "" + '>');
byte[ bytFile = System.Text.Encoding.UTF8.GetBytes(csvContentToShow);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "text/xml";
Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".xml");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(bytFile);
Response.End();
}
break;
case 4://PDF
uwgExportReport.DataBind();
this.uwgReportExpDocument.Format = Infragistics.Documents.Report.FileFormat.PDF;
this.uwgReportExpDocument.DownloadName = fileName + ".pdf";
// trigger export
this.uwgReportExpDocument.Export(uwgExportReport);
break;
case 5://XPS
uwgExportReport.DataBind();
this.uwgReportExpDocument.Format = Infragistics.Documents.Report.FileFormat.XPS;
this.uwgReportExpDocument.DownloadName = fileName + ".xps";
// trigger export
this.uwgReportExpDocument.Export(uwgExportReport);
break;
case 6://NOtepad -- Text
uwgExportReport.DataBind();
this.uwgReportExpDocument.Format = Infragistics.Documents.Report.FileFormat.PlainText;
this.uwgReportExpDocument.DownloadName = fileName + ".txt";
// trigger export
this.uwgReportExpDocument.Export(uwgExportReport);
break;
default:
//this.wpDownloadReport.Controls.Clear();
if (this.loadPlugin(outputFormat.Replace('_',' '), ref aMessage))
{
this.wpDownloadReport.Controls.Add(this.plugin.generate(this.wpDownloadReport, contentReportDs));
this.wpDownloadReport.Visible = true;
}
else
{
this.tbAlertMessage.Text = aMessage;
}
break;
}