Example #1
0
        private void tscbxReports_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (_isBinding)
                {
                    return;
                }

                if (_preview == null)
                {
                    _preview          = new FormPart.PreviewControl();
                    _preview.ReadOnly = true;
                    _preview.Hide();

                    this.Controls.Add(_preview);
                }

                _preview.ImportByXml("");

                ItemBind ib = tscbxReports.ComboBox.SelectedItem as ItemBind;

                ReportContextData reportData = null;

                if (ib.Data == null)
                {
                    return;
                }

                reportData = ib.Data as ReportContextData;

                _preview.ImportByXml(reportData.报告信息.报告内容);

                //读取对应报告模板信息
                string context = "";
                ReportTemplateItemData reportTemplate = ReportContextModel.GetReportTemplateData(reportData.报告信息.模板ID);
                foreach (JReportSectionItem si in reportTemplate.关联段落.段落关联信息)
                {
                    if (string.IsNullOrEmpty(si.模板元素名))
                    {
                        continue;
                    }

                    object eleContext = _preview.GetItemValue(si.模板元素名);

                    if (eleContext != null && string.IsNullOrEmpty(eleContext.ToString()) == false)
                    {
                        context = context + "■■" + ((string.IsNullOrEmpty(si.段落显示名)) ? si.报告段落名 : si.段落显示名) + ":" + System.Environment.NewLine + eleContext.ToString() + System.Environment.NewLine;
                        context = context + System.Environment.NewLine;
                    }
                }

                richTextBox1.Text = context;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
Example #2
0
        private void ReportViewControl_Load(object sender, EventArgs e)
        {
            try
            {
                _reportEdit = new FormPart.PreviewControl();
                panelReport.Controls.Add(_reportEdit);

                _reportEdit.Dock = DockStyle.Fill;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }