private void Report_Modification(CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt)
        {
            CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc1 = cryRpt.ReportClientDocument;
            ReportDefController2 reportDef = rptClientDoc1.ReportDefController;

            ReportSectionController reportSectionController = rptClientDoc1.ReportDefController.ReportSectionController;

            CrystalDecisions.ReportAppServer.ReportDefModel.Section newsec;

            int index = reportDef.ReportDefinition.PageHeaderArea.Sections.Count;

            //  CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject objPictureBox = new CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject();
            if (index > 0)
            {
                // reportDef.ReportDefinition.PageHeaderArea.Sections.Add(reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1]);
                newsec = reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1];//reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1];
            }
            else
            {
                index  = 0;
                newsec = reportDef.ReportDefinition.PageHeaderArea.Sections[index];
            }

            reportDef.ReportDefinition.PageHeaderArea.Sections.Insert(index, newsec);
            CrystalDecisions.ReportAppServer.ReportDefModel.Section sectionToAddTo = reportDef.ReportDefinition.PageHeaderArea.Sections[index];

            CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat newSectionFormat = sectionToAddTo.Format;
            newSectionFormat.EnableKeepTogether    = false;
            newSectionFormat.EnableSuppress        = false;
            newSectionFormat.EnableUnderlaySection = true;
            reportSectionController.SetProperty(sectionToAddTo, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat);
            reportDef.ReportObjectController.ImportPicture(AppDomain.CurrentDomain.BaseDirectory + @"IMAGE/AccessReportWatermarks1.png", sectionToAddTo, 500, 700);
        }
Beispiel #2
0
        private void Report_Modification(CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt)
        {
            CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc1 = cryRpt.ReportClientDocument;

            //ISCRParagraphTextElement paragraphTextElement = new ParagraphTextElementClass();
            //paragraphTextElement.Text = "DEMO VERSION";
            //paragraphTextElement.Kind = CrParagraphElementKindEnum.crParagraphElementKindText;

            //ParagraphElements paragraphElements = new ParagraphElementsClass();
            //paragraphElements.Add(paragraphTextElement);

            //Paragraph paragraph = new ParagraphClass();
            //paragraph.Alignment = CrAlignmentEnum.crAlignmentHorizontalCenter;
            //paragraph.ParagraphElements = paragraphElements;

            //Paragraphs paragraphs = new ParagraphsClass();
            //paragraphs.Add(paragraph);

            //ISCRTextObject textObject = new TextObjectClass();
            //textObject.Paragraphs = paragraphs;
            //textObject.FontColor.Font.Bold = true;
            //textObject.FontColor.Font.Size = 48;
            //textObject.FontColor.Font.Italic = true;
            //textObject.FontColor.Color = uint.Parse(ColorTranslator.ToOle(Color.Gray).ToString());
            //textObject.FontColor.Font.Charset = 30;
            //textObject.Height = 8000;
            //textObject.Top = this.Height;
            //textObject.Left = 5000;
            //textObject.Width = 1500;

            //textObject.Format.TextRotationAngle = CrTextRotationAngleEnum.crRotationAngleRotate90;

            //ISCRPictureObject imgObject = new PictureObjectClass();
            //imgObject.Kind = CrReportObjectKindEnum.crReportObjectKindPicture;



            //textObject.Format.HorizontalAlignment = CrAlignmentEnum.crAlignmentDecimal;

            ReportDefController2 reportDef = rptClientDoc1.ReportDefController;

            ReportSectionController reportSectionController = rptClientDoc1.ReportDefController.ReportSectionController;

            CrystalDecisions.ReportAppServer.ReportDefModel.Section newsec;

            int index = reportDef.ReportDefinition.PageHeaderArea.Sections.Count;

            //  CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject objPictureBox = new CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject();
            if (index > 0)
            {
                // reportDef.ReportDefinition.PageHeaderArea.Sections.Add(reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1]);
                newsec = reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1];//reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1];
            }
            else
            {
                index  = 0;
                newsec = reportDef.ReportDefinition.PageHeaderArea.Sections[index];
            }

            reportDef.ReportDefinition.PageHeaderArea.Sections.Insert(index, newsec);

            //newsec.Name = "Z";
            //ISCRArea ar = reportDef.ReportDefinition.PageHeaderArea;
            //ar.Name = "PH";
            //reportSectionController.Add(newsec, ar, index - 1);

            CrystalDecisions.ReportAppServer.ReportDefModel.Section sectionToAddTo = reportDef.ReportDefinition.PageHeaderArea.Sections[index];

            CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat newSectionFormat = sectionToAddTo.Format;
            newSectionFormat.EnableKeepTogether    = false;
            newSectionFormat.EnableSuppress        = false;
            newSectionFormat.EnableUnderlaySection = true;
            reportSectionController.SetProperty(sectionToAddTo, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat);
            reportDef.ReportObjectController.ImportPicture(AppDomain.CurrentDomain.BaseDirectory + @"IMAGE/AccessReportWatermarks1.png", sectionToAddTo, 500, 700);


            //reportDef.ReportObjectController.Add(textObject, sectionToAddTo, 0);
            //reportDef.ReportObjectController.Add(imgObject, sectionToAddTo, 0);

            //ReportObjectControllerClass objPictureBox = new ReportObjectControllerClass();
            //objPictureBox.ImportPicture(AppDomain.CurrentDomain.BaseDirectory + @"IMAGE/AccessReportWatermarks1.png", sectionToAddTo, 20, 20);
            //rptClientDoc1.ReportDefController = reportDef;
            //cryRpt.ReportClientDocument = rptClientDoc1;
        }