2017-09-19 7 views
0

Stiwebviewerを使用してStimulsoftでレポートを作成します。私はaspxファイルで表示します。今、私はレポートにPDFファイルをエクスポートするときなど、エクスポートに使用されたレポートファイル名を設定したいと思います。デフォルト名はReport(1).pdfです.Sedi.pdfに変更したいと思います。
私はこれを試してみてください。 stimulsoftのレポートのエクスポートファイル名の設定方法は?

StiWebViewer1.ServerReportName = "Sedi";

は、しかし、それは動作しませんでした。

答えて

0
string reportName = ""; 
protected void Page_Load(object sender, EventArgs e) 
    { 
     this.Mainreport = (StiReport)Session["SelectedReport"]; 
     this.reportName = (string)Session["ReportName"]; 
     StiWebViewer1.Report = this.Mainreport; 
     StiWebViewer1.DataBind(); 
     if (!IsPostBack) 
     { 
      string iQueryString = Request.QueryString["sti_StiWebViewer1_export"]; 
      if (iQueryString != null) this.SaveFile(iQueryString); 
     } 
    } 
    private void SaveFile(string iQueryString) 
    { 
     if (this.reportName == null) this.reportName = "Report"; 
     MemoryStream mes = new MemoryStream(); 
     HttpContext.Current.Response.Clear(); 
     switch (iQueryString) 
     { 
      #region Cases 
      case "SaveAdobePdf": 
       { 
        this.Mainreport.ExportDocument(StiExportFormat.Pdf, mes); 
        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + this.reportName + ".Pdf"); 
       } 
       break; 
      case "SaveMicrosoftXps": 
       { 
        this.Mainreport.ExportDocument(StiExportFormat.Xps, mes); 
        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + this.reportName + ".Xps"); 
       } 
       break; 
       #endregion 
     } 
     mes.WriteTo(Response.OutputStream); 
     HttpContext.Current.Response.End(); 
     mes.Close(); 
    } 
関連する問題