Beispiel #1
0
        private void CreateBackGroundReport(String RDLCName,
            Dictionary<String, Object> DataSources,
            String ReportPDFFileName = null,
            String ReportHeadLineText = null,
            String TargetRenderFormat = "PDF",
            String SubDir = null,
            Dictionary<String, String> PictureFileNames = null)
            {
            String Extension = ".pdf";
            if (TargetRenderFormat == "WORD")
                Extension = ".doc";
            if (TargetRenderFormat == "EXCEL")
                Extension = ".xls";
            WordUpReportContainer ReportControl = new WordUpReportContainer();
            String FinalTargetDirectory = DataWrapper.Instance.TargetDirectory;
            if (!String.IsNullOrEmpty(SubDir))
                {
                FinalTargetDirectory = Path.Combine(DataWrapper.Instance.TargetDirectory, SubDir);
                }
            if (!Directory.Exists(FinalTargetDirectory))
                Directory.CreateDirectory(FinalTargetDirectory);
            if (String.IsNullOrEmpty(ReportPDFFileName))
                ReportControl.TargetRenderFileName = System.IO.Path.Combine
                    (FinalTargetDirectory, RDLCName + Extension);
            else
                ReportControl.TargetRenderFileName = System.IO.Path.Combine
                    (FinalTargetDirectory, ReportPDFFileName + Extension);
            if (!Directory.Exists(FinalTargetDirectory))
                Directory.CreateDirectory(FinalTargetDirectory);
            if (!Directory.Exists(Path.GetDirectoryName(ReportControl.TargetRenderFileName)))
                Directory.CreateDirectory(Path.GetDirectoryName(ReportControl.TargetRenderFileName));
            ReportControl.ReportRDLCToShow = RDLCName;
            ReportControl.ReportHeadlineText = ReportHeadLineText;
            ReportControl.PictureFileNames = PictureFileNames;
            ReportControl.DataSources = DataSources;
            ReportControl.TargetRenderFormat = TargetRenderFormat;

            ReportControl.RenderOnly();
            }
Beispiel #2
0
        private void CreateBackGroundReportAndWindow(Window ChartWindow, String RDLCName,
            Dictionary<String, Object> DataSources,
            String ReportPDFFileName = null,
            String ReportHeadLineText = null,
            String TargetRenderFormat = "PDF",
            String SubDir = "Charts")
            {
            if (ChartWindow != null)
                ChartWindow.Close();
            ChartWindow = new Window();
            String Extension = ".pdf";
            if (TargetRenderFormat == "WORD")
                Extension = ".doc";
            if (TargetRenderFormat == "EXCEL")
                Extension = ".xls";
            WordUpReportContainer ReportControl = new WordUpReportContainer();
            String FinalTargetDirectory = DataWrapper.Instance.TargetDirectory;
            if (!String.IsNullOrEmpty(SubDir))
                {
                FinalTargetDirectory = Path.Combine(DataWrapper.Instance.TargetDirectory, SubDir);
                }
            if (!Directory.Exists(FinalTargetDirectory))
                Directory.CreateDirectory(FinalTargetDirectory);
            if (String.IsNullOrEmpty(ReportPDFFileName))
                ReportControl.TargetRenderFileName = System.IO.Path.Combine
                    (FinalTargetDirectory, RDLCName + Extension);
            else
                ReportControl.TargetRenderFileName = System.IO.Path.Combine
                    (FinalTargetDirectory, ReportPDFFileName + Extension);
            if (!Directory.Exists(FinalTargetDirectory))
                Directory.CreateDirectory(FinalTargetDirectory);
            if (!Directory.Exists(Path.GetDirectoryName(ReportControl.TargetRenderFileName)))
                Directory.CreateDirectory(Path.GetDirectoryName(ReportControl.TargetRenderFileName));
            ReportControl.ReportRDLCToShow = RDLCName;
            ReportControl.ReportHeadlineText = ReportHeadLineText;
			ReportControl.DataSources = DataSources;
            ReportControl.CommonParameterValues = CommonParameterValues;
            ReportControl.TargetRenderFormat = TargetRenderFormat;
            ChartWindow.Content = ReportControl;
            ChartWindow.Show();
            }