protected override void OnShown(EventArgs e) { base.OnShown(e); this.Update(); GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); ReportFileParser parser = new ReportFileParser(); byte[] byteFileData = null; parser.MakeReportData(this.m_szDesignData, this.m_szScriptData, out byteFileData); this.reportDesigner1.Focus(); this.reportDesigner1.IsDesignMode = true; this.reportDesigner1.Readonly = true; this.reportDesigner1.OpenDocument(byteFileData); this.reportDesigner1.CanvasElement.ShowGrid = false; GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <summary> /// 保存当前正在编辑的模板文件 /// </summary> /// <returns>bool</returns> internal bool SaveReport() { DesignEditForm designForm = this.ActiveReport; ScriptEditForm scriptForm = this.ActiveScript; if (scriptForm == null && designForm == null) { return(false); } if (designForm != null) { scriptForm = this.GetScriptForm(designForm); } else if (scriptForm != null) { designForm = this.GetDesignForm(scriptForm); } ReportFileParser parser = new ReportFileParser(); string szScriptData = null; if (scriptForm != null) { szScriptData = scriptForm.Save(); } else { szScriptData = parser.GetScriptData(designForm.HndfFile); } string szDesignData = null; if (designForm != null) { designForm.Save(ref szDesignData); } else { szDesignData = parser.GetDesignData(scriptForm.HndfFile); } byte[] byteTempletData = null; parser.MakeReportData(szDesignData, szScriptData, out byteTempletData); DialogResult result = MessageBoxEx.ShowQuestion("是否提交到服务器?" + "\r\n提交到服务器,请点击“是”按钮!\r\n仅保存到本地,请点击“否”按钮!"); if (result == DialogResult.Cancel) { return(false); } bool success = true; if (result == DialogResult.No) { success = this.SaveReportToLocal(byteTempletData); } else { success = this.SaveReportToServer(byteTempletData); } if (success) { if (designForm != null) { designForm.IsModified = false; } if (scriptForm != null) { scriptForm.IsModified = false; } } return(success); }