Esempio n. 1
0
        private void InitReportData()
        {
            catlogTable.Rows.Add(new object[] { -1 });
            ReportData reportData = new ReportData(report);

            reportData.InitReportData(catlogTable);

            report.InitReportData(reportData);
        }
 public void NewReport(MutliProjectManager projectManager)
 {
     report = new Report(this.reportName, this.level);
     //report.DocPath = reportSrc;
     report.PropertyValid = true;
     report.ReadRPT("report_WORD报表模板.rpt");
     //report.DllPath = Path.Combine(Function.ReportFolder, "report_项目工程宏变量列表.dll");
     report.PropertyValid = true;
     report.InitReportData(projectManager, -1);
 }
        //刷新当前报表节点
        public void ReferenceFocusedNode()
        {
            if (ReportList.FocusedNode == null)
            {
                return;
            }
            //InitMutliProjectStruct();
            string fileName = ReportList.FocusedNode.GetValue("src").ToString();

            if (!string.IsNullOrEmpty(fileName))
            {
                string descrName  = ReportList.FocusedNode.GetValue("name").ToString();
                int    descrLevel = 0;
                if (!int.TryParse(ReportList.FocusedNode.GetValue("level").ToString(), out descrLevel))
                {
                    Function.Alert("报表相关XML的LEVEL数据无效!", "提示");
                }
                curReport = new Report(descrName, descrLevel);

                curReport.ReadRPT(fileName);

                //用户报表
                string userFilePath = curReport.RptFilePath;
                if (userFilePath.StartsWith(Function.UserReportFolder))
                {
                    string sysFilePath = Function.ReportFolder + fileName;
                    if (File.GetLastWriteTime(sysFilePath) > File.GetLastWriteTime(userFilePath))
                    {
                        //系统报表新于用户报表,更新用户报表,保留原有列显示信息和参数设置
                        Report newReport = new Report(descrName, descrLevel);
                        newReport.RptFilePath = sysFilePath;
                        newReport.ReadRPT();
                        foreach (ReportColumn column in newReport.Columns)
                        {
                            ReportColumn col = curReport.Columns.Find(column.ColumnName);
                            if (col != null)
                            {
                                column.Attibutes.PrintStyle.NoPrint = col.Attibutes.PrintStyle.NoPrint;
                            }
                        }
                        curReport             = newReport;
                        curReport.RptFilePath = userFilePath;
                        curReport.WriteRpt(false);
                    }
                }

                arguments.Enabled = (Function.ProfileInt(curReport.RptFilePath, "报表参数", "enabled", 0) == 1 &&
                                     Function.ProfileInt(curReport.RptFilePath, "报表参数", "count", 0) != 0);
                //初始化预览方式数据
                //curReport.InitReportData(projectDataManager, 0);
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict["生成方式"] = "预览";
                curReport.InitReportData(projectDataManager.ProjectData as DataSet, dict);
                Repaint();
            }
            else
            {
                curReport        = null;
                ReportMode.Image = null;
            }
        }