WEB应用程序中调用水晶报表,一切正常,用水晶报表自带的工具条进行导出:(1)导出PDF和Word格式均正常,但是导出Excel格式则发生变化,连水晶报表工具条都一起导出,而且数据排成一列,实在找不出什么原因导致(2)现在每次导出时报表都是自动打开,怎么设置能在打开前先出现提示保存对话框?系统怎么只允许最多给100分,解决了我肯定再给!

解决方案 »

  1.   

    在crystalViewer控件中的导出.
    case "MS Excel (XLS)":
    rptDoc.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.Excel;
    cryDiskF.DiskFileName = filePathNameXLS;
    rptDoc.ExportOptions.DestinationOptions = cryDiskF;
    rptDoc.SetParameterValue("InvID",AVal); 
    rptDoc.Export();
    rptDoc.Close();
    //
    Response.Clear();
    Response.Buffer = true;
    Response.AddHeader("Content-Type", "application/xls");
    Response.AddHeader("Content-Disposition", "attachment;filename="+ Session.SessionID+".xls;");
    fs = new FileStream(filePathNameXLS,FileMode.Open);
    fileSize = fs.Length;
    bBuffer = new byte[Int32.Parse(fileSize.ToString())];
    fs.Read(bBuffer,0,Int32.Parse(fileSize.ToString()));
    fs.Close(); Response.BinaryWrite(bBuffer);
    Response.Flush();
    Response.Close();
    break;