private void ImprimirGrid()
        {
            /******************************/
            // Creamos el Header
            PageHeaderArea Header = new PageHeaderArea();

            ComponenteImpresion.Images.Add(Image.FromFile(Environment.CurrentDirectory + "\\logomini.png"));
            Header.Content.AddRange(new string[] { "[Image 0]", Properties.Settings.Default.Sucursal, "[Time Printed]" });
            Header.LineAlignment = BrickAlignment.Far;
            /******************************/

            /******************************/
            //Creamos el Footer
            string         izquierda = "Paginas: [Page # of Pages #]";
            string         centro    = "Usuario: [User Name]";
            string         derecha   = "Fecha: [Date Printed]";
            PageFooterArea Footer    = new PageFooterArea();

            Footer.Content.AddRange(new string[] { izquierda, centro, derecha });
            Footer.LineAlignment = BrickAlignment.Near;
            /*****************************/

            /******************************/
            //Agregar el Grid al documento
            ComponenteImpresion.Component = gridEtiquetas;
            //Agregar el header y el footer al documento
            ComponenteImpresion.PageHeaderFooter = new PageHeaderFooter(Header, Footer);
            //Crear el documento
            ComponenteImpresion.CreateDocument(SistemaImpresion);
            //Mostrar la vista previa para imprimir
            ComponenteImpresion.ShowPreviewDialog();
        }
Пример #2
0
        public void ShowRibbonPreview(IPrintable component, string title)
        {
            //HEADER
            PageHeaderArea header = new PageHeaderArea();

            header.Content.Add(string.Empty);
            header.Content.Add(title);
            header.LineAlignment = BrickAlignment.Center;
            header.Font          = new Font("Tahoma", 16, FontStyle.Bold);

            //FOOTER
            PageFooterArea footer = new PageFooterArea();

            footer.Content.AddRange(new string[] { "", "", "Página: [Page #]" });

            //UNION HEADER/FOOTER
            PageHeaderFooter headerfooter = new PageHeaderFooter(header, footer);

            PrintableComponentLink print = new PrintableComponentLink(new PrintingSystem());

            print.Component        = component;
            print.PageHeaderFooter = headerfooter;
            print.PaperKind        = PaperKind.A4;
            print.Margins          = new Margins(60, 30, 60, 60);
            print.CreateDocument();
            print.ShowRibbonPreview(this.LookAndFeel);
        }
Пример #3
0
        /// <summary>
        /// 获取页面设置信息
        /// </summary>
        private void LoadPageSetting()
        {
            try
            {
                if (!System.IO.File.Exists(_PrintSettingFile))
                {
                    return;
                }
                XmlSerializer    ser     = new XmlSerializer(typeof(PrintPageSetting));
                PrintPageSetting setting = (PrintPageSetting)ser.Deserialize(new FileStream(_PrintSettingFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
                Margins          m       = new Margins(setting.Left, setting.Right, setting.Top, setting.Bottom);
                _printingSystem.PageSettings.Assign(m, (PaperKind)setting.PaperKind, setting.Landscape);
                _printingSystem.PageSettings.PrinterName = setting.PrinterName;
                System.Drawing.Font headerfont = new System.Drawing.Font(setting.headerFont.Name, setting.headerFont.Size, setting.headerFont.Style);
                string[]            arrheader  = getStringArray(setting.headerContent);
                PageHeaderArea      header     = new PageHeaderArea(arrheader, headerfont, setting.headerAlign);

                System.Drawing.Font footerfont = new System.Drawing.Font(setting.footerFont.Name, setting.footerFont.Size, setting.footerFont.Style);
                string[]            arrfoot    = getStringArray(setting.footerContent);
                PageFooterArea      footer     = new PageFooterArea(arrfoot, footerfont, setting.footerAlign);
                PageHeaderFooter    pagehf     = new PageHeaderFooter(header, footer);
                _printableComponentLink.PageHeaderFooter = pagehf;
            }
            catch { }
        }
Пример #4
0
        private void Imprimir()
        {
            PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());

            PageHeaderArea headerArea;

            headerArea = new PageHeaderArea();
            headerArea.Content.Add(Environment.NewLine);
            headerArea.Content.Add(Properties.Settings.Default.Sucursal);
            headerArea.Content.Add(DateTime.Today.ToShortDateString());
            headerArea.LineAlignment = BrickAlignment.Center;

            PageFooterArea   footerArea;
            PageHeaderFooter headerfooter;

            footerArea = new PageFooterArea();
            footerArea.Content.Add("[Page #]");
            footerArea.LineAlignment = BrickAlignment.Far;

            headerfooter          = new PageHeaderFooter(headerArea, footerArea);
            link.PageHeaderFooter = headerfooter;

            link.Component = gridExistencia;
            link.CreateDocument();

            this.gvExistencia.FocusedRowHandle = -1;


            link.ShowPreviewDialog();
        }
Пример #5
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            var titleSb = new StringBuilder(80);

            GetCurrentSiteMapNodes().ForEach(n => titleSb.AppendFormat("{0}: ", n.ToString()));
            titleSb.Append(FormsAuthentication.CookieDomain);
            Title.Text = titleSb.ToString();

            //setting page header by site map
            if (SetPageHeaderBySiteMap && PageHeaderArea != null)
            {
                var pageHeader =
                    PageHeaderArea.EnumerateChildControls(c => c.ID == "_PageHeader").FirstOrDefault() as ITextControl;
                string pageHeaderText = GetCurrentTopNodeText();

                //when pageHeaderText is null or empty, means most probably the page is not in sitemap
                //so we ignore it.
                if (pageHeader != null && !string.IsNullOrEmpty(pageHeaderText))
                {
                    pageHeader.Text = pageHeaderText;
                }
            }

            //base.OnPreRender(e);
        }
Пример #6
0
        private static void BaslikEkle()
        {
            if (_dp.BaslikEkle == COMMON.Enums.EvetHayir.Hayir)
            {
                return;
            }

            var headerArea = new PageHeaderArea();

            headerArea.Content.AddRange(new[] { "", _dp.RaporBaslik });
            headerArea.Font          = new System.Drawing.Font("Arial Narrow", 10f, System.Drawing.FontStyle.Bold);
            headerArea.LineAlignment = BrickAlignment.Far;
            _link.PageHeaderFooter   = new PageHeaderFooter(headerArea, null);
        }
Пример #7
0
        public void DoPivoitPrint(PivotGridControl pivotGridControl, bool landscape = true)
        {
            var link = new PrintableComponentLink(new PrintingSystem())
            {
                Margins = { Left = 10, Right = 10, Top = 110, Bottom = 90 },
                Landscape = landscape,
                PaperKind = PaperKind.A4,
                Component = pivotGridControl
            };

            var footer = new PageFooterArea();
            footer.Content.Add("Printed on " + "[Date Printed]" + " by " + Utils.Username);
            footer.Content.Add("Page " + "[Page #]");
            footer.LineAlignment = BrickAlignment.Near;
            var header = new PageHeaderArea();

            link.CreateMarginalHeaderArea += CreateMarginalDetailHeaderArea;
            link.CreateMarginalFooterArea += CreateMarginalFooterArea;

            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.CreateDocument();

            link.PrintingSystem.Document.AutoFitToPagesWidth = 1;

            link.ShowRibbonPreview(UserLookAndFeel.Default);
        }
Пример #8
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);


        }
Пример #9
0
        public void CreateReport()
        {
            var link = new PrintableComponentLink(new PrintingSystem());
            link.Margins.Left = 100;
            link.Margins.Right = 100;
            link.Margins.Top = 100;
            link.Margins.Bottom = 90;
            link.PaperKind = PaperKind.A4;
            if (LoadReport == 0)
                link.Component = gridControl1;
            if (LoadReport == 1)
            {
                link.Component = gridControl2;
                link.Landscape = true;
            }

            PageFooterArea footer = new PageFooterArea();
            footer.Content.Add("Printed on " + "[Date Printed]" + " by " + Utils.Username);
            footer.LineAlignment = BrickAlignment.Near;
            PageHeaderArea 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.CreateDocument();
            link.PrintingSystem.Document.AutoFitToPagesWidth = 1;
            link.ShowRibbonPreview(UserLookAndFeel.Default);
        }