예제 #1
0
        public void CreateReport()
        {
            var link = new CompositeLink(new PrintingSystem());

            var link1 = new PrintableComponentLink();
            var pcLink1 = new PrintableComponentLink();
            var footer = new PageFooterArea();
            footer.Content.Add("Printed on " + "[Date Printed]" + " by " + Utils.Username);
            footer.LineAlignment = BrickAlignment.Near;
            var header = new PageHeaderArea();
            link.CreateMarginalHeaderArea += CreateMarginalHeaderArea;
            link.PageHeaderFooter = new PageHeaderFooter(header, footer);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Save, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Watermark, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.FillBackground, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.HandTool, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Customize, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Scale, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Parameters, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.SubmitParameters, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Background, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.None, CommandVisibility.None);
            link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.DocumentMap, CommandVisibility.None);
  


            link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Document"].Visible = false;
            link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Background"].Visible =false;
            link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Zoom"].Visible =false;


            link.Margins.Left = 100;
            link.Margins.Right = 100;
            link.Margins.Top = 100;
            link.Margins.Bottom = 90;
            link.PaperKind = PaperKind.A4;

            var linkGrid1Report = new Link();
            linkGrid1Report.CreateDetailArea += linkGrid1Report_CreateDetailArea;


            var linkGrid2Report = new Link();

           // link.PrintingSystem.Document.AutoFitToPagesWidth = 1;

            link1.Component = gridControl1;
            

             
            link.Links.Add(link1);

            link.Links.Add(linkGrid1Report);
            pcLink1.Component = gridControl2;
            link.Links.Add(pcLink1);
            

            link.CreateDocument();

            //if (string.IsNullOrEmpty(watermark))
            //    link.PrintingSystemBase.Watermark.Text = "Draft";
            //else
            //{
            //    link.PrintingSystemBase.Watermark.Text = "watermark";
            //}
            link.ShowRibbonPreview(UserLookAndFeel.Default);


        }