Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void GetSectionFormat(Section section, ReportDocument report, XmlWriter writer)
        {
            writer.WriteStartElement("SectionFormat");

            writer.WriteAttributeString("CssClass", section.SectionFormat.CssClass);
            writer.WriteAttributeString("EnableKeepTogether", section.SectionFormat.EnableKeepTogether.ToString());
            writer.WriteAttributeString("EnableNewPageAfter", section.SectionFormat.EnableNewPageAfter.ToString());
            writer.WriteAttributeString("EnableNewPageBefore", section.SectionFormat.EnableNewPageBefore.ToString());
            writer.WriteAttributeString("EnablePrintAtBottomOfPage", section.SectionFormat.EnablePrintAtBottomOfPage.ToString());
            writer.WriteAttributeString("EnableResetPageNumberAfter", section.SectionFormat.EnableResetPageNumberAfter.ToString());
            writer.WriteAttributeString("EnableSuppress", section.SectionFormat.EnableSuppress.ToString());
            writer.WriteAttributeString("EnableSuppressIfBlank", section.SectionFormat.EnableSuppressIfBlank.ToString());
            writer.WriteAttributeString("EnableUnderlaySection", section.SectionFormat.EnableUnderlaySection.ToString());

            CRReportDefModel.Section rdm_ro = GetRASRDMSectionObjectFromCRENGSectionObject(section.Name, report);
            if (rdm_ro != null)
            {
                GetSectionAreaFormatConditionFormulas(rdm_ro, writer);
            }


            if ((ShowFormatTypes & FormatTypes.Color) == FormatTypes.Color)
            {
                GetColorFormat(section.SectionFormat.BackgroundColor, writer, "BackgroundColor");
            }

            writer.WriteEndElement();
        }
Exemplo n.º 3
0
        private static void GetSectionAreaFormatConditionFormulas(CRReportDefModel.Section ro, XmlWriter writer)
        {
            writer.WriteStartElement("SectionAreaConditionFormulas");
            var cfs = Enum.GetValues(typeof(CRReportDefModel.CrSectionAreaFormatConditionFormulaTypeEnum));

            //TODO: need to cut this down by Area.Kind to only show relevant attributes, i.e. Page Clamp is only valid on Page Footer.
            foreach (CRReportDefModel.CrSectionAreaFormatConditionFormulaTypeEnum cf in cfs)
            {
                var formula = ro.Format.ConditionFormulas[cf];
                if (!String.IsNullOrEmpty(formula.Text))
                {
                    writer.WriteAttributeString(GetShortEnumName(cf, "crSectionAreaConditionFormulaType"), formula.Text);
                }
            }
            writer.WriteEndElement();
        }
Exemplo n.º 4
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;
        }