private void simpleButton1_Click(object sender, EventArgs e) { string saveFileName = GetReportPath(fReport, "sav"); fReport.PrintingSystem.ExecCommand(PrintingSystemCommand.StopPageBuilding); fReport.SaveLayout(saveFileName); using (XtraReport newReport = XtraReport.FromFile(saveFileName, true)) { XRDesignFormExBase designForm = new CustomDesignForm(); designForm.OpenReport(newReport); designForm.FileName = fileName; ShowDesignerForm(designForm, this.FindForm()); if (designForm.FileName != fileName && File.Exists(designForm.FileName)) { File.Copy(designForm.FileName, fileName, true); } designForm.OpenReport((XtraReport)null); designForm.Dispose(); } if (File.Exists(fileName)) { fReport.LoadLayout(fileName); File.Delete(fileName); fReport.CreateDocument(true); } ShowParameters(); File.Delete(saveFileName); InitializeControls(); }
///// <summary> ///// ///// </summary> ///// <param name="templateFile">报表文件</param> ///// <param name="ds">数据集</param> //public ReportDesign(string templateFile, DataSet ds, XRDesignFormExBase form) //{ // _templateSource = ds; // _templateStr = templateFile; // m_frm = form; // Design(); //} #region FormDataSoruce //private DataTable m_ReportDataSoruce = new DataTable(); //private string m_Path = string.Empty; //private void m_frm_Load(object sender, EventArgs e) //{ // m_frm.Visible = true; // FormDataSoruce formSoruce = new FormDataSoruce(); // if (formSoruce.ShowDialog() == DialogResult.OK) // { // m_ReportDataSoruce = formSoruce.ReportDataSoruce.Copy(); // m_Path = formSoruce.Path; // DataSet ds = new DataSet(); // ds.Tables.Add(m_ReportDataSoruce); // m_frm.Visible = true; // ReportDesign rp = new ReportDesign(m_Path, ds); // rp.Design(); // } // else // { // m_frm.Close(); // } //} //#endregion #endregion /// <summary> /// 给出设计界面 /// </summary> public void Design() { //初始化报表设计界面 if (m_FromStream) { _reportUtil = new XReport(_templateStr, _templateSource); } else { _reportUtil = new XReport(_templateSource, _templateStr); } if (m_frm == null) { m_frm = new CustomDesignForm(); m_frm.SkipQueryData = true; m_frm.WindowState = FormWindowState.Maximized; } if (AUTOSAVE) { m_frm.ReportStateChanged += new ReportStateEventHandler(m_frm_ReportStateChanged); m_frm.Closing += new System.ComponentModel.CancelEventHandler(m_frm_Closing); } m_frm.TextChanged += new EventHandler(m_frm_TextChanged); m_frm.FileName = _reportUtil.FileName; ReportUtil.DataSource = _templateSource; ReportUtil.DataSource.DataSetName = "ReportDesign"; m_frm.OpenReport(_reportUtil.CurrentReport); m_frm.ShowDialog(); }
private void BbiDesignItemClick(object sender, ItemClickEventArgs e) { if (this._fReport != null) { this._fReport.ShowDesignerDialog(); } string reportPath = Vssoft.Common.Report.Helper.GetReportPath(this._fReport, "sav"); if (this._fReport != null) { this._fReport.PrintingSystem.ExecCommand(PrintingSystemCommand.StopPageBuilding); this._fReport.SaveLayout(reportPath); } using (XtraReport report = XtraReport.FromFile(reportPath, true)) { XRDesignFormExBase designForm = new CustomDesignForm(); designForm.OpenReport(report); designForm.FileName = ""; ShowDesignerForm(designForm, base.FindForm()); if ((designForm.FileName != "") && File.Exists(designForm.FileName)) { File.Copy(designForm.FileName, "", true); } designForm.OpenReport((XtraReport)null); designForm.Dispose(); } if (File.Exists("")) { if (this._fReport != null) { this._fReport.LoadLayout(""); } File.Delete(""); if (this._fReport != null) { this._fReport.CreateDocument(true); } } this.ShowParameters(); File.Delete(reportPath); InitializeControls(); }