예제 #1
0
        // load report, data, bind, render
        private void Render()
        {
            // get application path
            string path = Application.StartupPath;
            int    pos  = path.IndexOf(@"\bin");

            if (pos > -1)
            {
                path = path.Substring(0, pos);
            }

            // load report into control
            string reportFile = path + @"\hierReport.xml";

            _c1r.Load(reportFile, "Customers");

            // load data into DataSet
            DataSet ds       = new DataSet();
            string  dataFile = path + @"\hierData.xml";

            ds.ReadXml(dataFile);

            // connect data set to report (and subreports)
            ConnectDataSet(ds, _c1r);

            // go show report
            Cursor          = Cursors.WaitCursor;
            _ppv.ZoomFactor = 1;
            _ppv.Document   = _c1r;
            Cursor          = Cursors.Default;
        }
예제 #2
0
        // load the report that is currently selected in the listbox
        private bool LoadReport()
        {
            if (lstReports.Text.Length == 0)
            {
                return(false);
            }

            bool retval = true;

            ShowStatus(string.Format("[{0}]: Loading...", lstReports.Text));
            Cursor = Cursors.WaitCursor;
            try
            {
                c1Report1.Load(m_ReportFile, lstReports.Text);
            }
            catch (Exception x)
            {
                MessageBox.Show("Failed to load the report:\r\n" + x.Message);
                retval = false;
            }

            Cursor = Cursors.Default;
            ShowStatus("Ready");
            return(retval);
        }
예제 #3
0
        /// <summary>
        /// 设置预览的报表文档(一般是XML的打印格式文档)
        /// </summary>
        /// <param name="reportFileName">报表定义文件名如:KDSUI.PrintTemplate.SD.SEDo.xml</param>
        /// <param name="reportTitle">报表标题</param>
        /// <param name="xmlRecordset">报表数据源</param>
        /// <param name="lPrintMode">打印界面模式</param>
        /// <param name="dllType">嵌入式报表格式文档的类型名(完整)</param>
        public void SetPrintDocumnet(string reportFileName, string reportTitle, object xmlRecordset, bool lPrintMode, Type dllType)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(GetStreamString(Assembly.GetAssembly(dllType).GetManifestResourceStream(reportFileName)));
            c1Report1 = new C1Report();
            c1Report1.Load(doc, reportTitle);
            c1Report1.DataSource.Recordset  = xmlRecordset;
            c1PrintPreviewControl1.Document = c1Report1.Document;

            if (lPrintMode)
            {
                c1PrintPreviewControl1.PreviewPane.Print();
            }

            if (!lPrintMode)
            {
                c1PrintPreviewControl1.ToolBars.File.Print.Visible = false;
            }
        }
예제 #4
0
        /// <summary>
        /// 设置预览的报表文档(一般是XML的打印格式文档)
        /// </summary>
        /// <param name="reportFileName">报表定义文件名如:Data\SEDo.xml</param>
        /// <param name="reportTitle">报表标题</param>
        /// <param name="xmlRecordset">报表数据源</param>
        public void SetPrintDocument(string reportFileName, string reportTitle, object xmlRecordset, bool lPrintMode)
        {
            if (!File.Exists(reportFileName))
            {
                throw new Exception("报表格式文件不存在:" + reportFileName);
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(reportFileName);
            c1Report1 = new C1Report();
            c1Report1.Load(doc, reportTitle);
            c1Report1.DataSource.Recordset  = xmlRecordset;
            c1PrintPreviewControl1.Document = c1Report1.Document;

            if (lPrintMode)
            {
                c1PrintPreviewControl1.PreviewPane.Print();
            }

            if (!lPrintMode)
            {
                c1PrintPreviewControl1.ToolBars.File.Print.Visible = false;
            }
        }