Beispiel #1
0
        public void CargarXml(XmlDocument xmlDoc)
        {
            this.Campos.Clear();
            XmlNode Plant = xmlDoc.SelectSingleNode("/Plantilla");

            if (Plant.Attributes["Fuente"] != null && Plant.Attributes["TamanoFuente"] != null)
            {
                float TamanoFuente = ((float)(Lfx.Types.Parsing.ParseDecimal(Plant.Attributes["TamanoFuente"].Value)));
                this.Font = new System.Drawing.Font(Plant.Attributes["Fuente"].Value, TamanoFuente);
            }
            foreach (XmlNode Cam in Plant.ChildNodes)
            {
                if (Cam.Name == "Campo")
                {
                    Campo NuevoCampo = new Campo();
                    NuevoCampo.Valor = Cam.Attributes["Valor"].Value;
                    if (Cam.Attributes["Formato"] != null)
                    {
                        NuevoCampo.Formato = Cam.Attributes["Formato"].Value;
                    }
                    if (Cam.Attributes["AnchoBorde"] != null)
                    {
                        NuevoCampo.AnchoBorde = Lfx.Types.Parsing.ParseInt(Cam.Attributes["AnchoBorde"].Value);
                    }
                    if (Cam.Attributes["ColorBorde"] != null)
                    {
                        Color Col = System.Drawing.Color.FromArgb(Lfx.Types.Parsing.ParseInt(Cam.Attributes["ColorBorde"].Value));
                        // Quito el canal alfa
                        NuevoCampo.ColorBorde = System.Drawing.Color.FromArgb(255, Col);
                    }
                    if (Cam.Attributes["ColorTexto"] != null)
                    {
                        Color Col = System.Drawing.Color.FromArgb(Lfx.Types.Parsing.ParseInt(Cam.Attributes["ColorTexto"].Value));
                        // Quito el canal alfa
                        NuevoCampo.ColorTexto = System.Drawing.Color.FromArgb(255, Col);
                    }
                    if (Cam.Attributes["ColorFondo"] != null)
                    {
                        Color Col = System.Drawing.Color.FromArgb(Lfx.Types.Parsing.ParseInt(Cam.Attributes["ColorFondo"].Value));
                        // Quito el canal alfa
                        if (Col == Color.FromArgb(0, 0, 0, 0))
                        {
                            NuevoCampo.ColorFondo = Color.Transparent;
                        }
                        else
                        {
                            NuevoCampo.ColorFondo = System.Drawing.Color.FromArgb(255, Col);
                        }
                    }
                    NuevoCampo.Rectangle.X      = Lfx.Types.Parsing.ParseInt(Cam.Attributes["X"].Value);
                    NuevoCampo.Rectangle.Y      = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Y"].Value);
                    NuevoCampo.Rectangle.Width  = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Ancho"].Value);
                    NuevoCampo.Rectangle.Height = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Alto"].Value);
                    if (Cam.Attributes["AlineacionRenglon"] != null)
                    {
                        switch (Cam.Attributes["AlineacionRenglon"].Value)
                        {
                        case "Far":
                            NuevoCampo.LineAlignment = System.Drawing.StringAlignment.Far;
                            break;

                        case "Center":
                            NuevoCampo.LineAlignment = System.Drawing.StringAlignment.Center;
                            break;

                        default:
                            NuevoCampo.LineAlignment = System.Drawing.StringAlignment.Near;
                            break;
                        }
                    }
                    if (Cam.Attributes["Alineacion"] != null)
                    {
                        switch (Cam.Attributes["Alineacion"].Value)
                        {
                        case "Far":
                            NuevoCampo.Alignment = System.Drawing.StringAlignment.Far;
                            break;

                        case "Center":
                            NuevoCampo.Alignment = System.Drawing.StringAlignment.Center;
                            break;

                        default:
                            NuevoCampo.Alignment = System.Drawing.StringAlignment.Near;
                            break;
                        }
                    }
                    if (Cam.Attributes["Fuente"] != null && Cam.Attributes["TamanoFuente"] != null)
                    {
                        float TamanoFuenteCampo = ((float)(Lfx.Types.Parsing.ParseDecimal(Cam.Attributes["TamanoFuente"].Value)));
                        NuevoCampo.Font = new System.Drawing.Font(Cam.Attributes["Fuente"].Value, TamanoFuenteCampo);
                    }
                    if (Cam.Attributes["Wrap"] != null)
                    {
                        NuevoCampo.Wrap = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Wrap"].Value) != 0;
                    }

                    if (Cam.Attributes["Preimpreso"] != null)
                    {
                        NuevoCampo.Preimpreso = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Preimpreso"].Value) != 0;
                    }
                    this.Campos.Add(NuevoCampo);
                }
            }
        }
Beispiel #2
0
                public void CargarXml(XmlDocument xmlDoc)
                {
                        this.Campos.Clear();
                        XmlNode Plant = xmlDoc.SelectSingleNode("/Plantilla");
                        if (Plant.Attributes["Fuente"] != null && Plant.Attributes["TamanoFuente"] != null) {
                                float TamanoFuente = ((float)(Lfx.Types.Parsing.ParseDecimal(Plant.Attributes["TamanoFuente"].Value)));
                                this.Font = new System.Drawing.Font(Plant.Attributes["Fuente"].Value, TamanoFuente);
                        }
                        foreach (XmlNode Cam in Plant.ChildNodes) {
                                if (Cam.Name == "Campo") {
                                        Campo NuevoCampo = new Campo();
                                        NuevoCampo.Valor = Cam.Attributes["Valor"].Value;
                                        if (Cam.Attributes["Formato"] != null)
                                                NuevoCampo.Formato = Cam.Attributes["Formato"].Value;
                                        if (Cam.Attributes["AnchoBorde"] != null)
                                                NuevoCampo.AnchoBorde = Lfx.Types.Parsing.ParseInt(Cam.Attributes["AnchoBorde"].Value);
                                        if (Cam.Attributes["ColorBorde"] != null) {
                                                Color Col = System.Drawing.Color.FromArgb(Lfx.Types.Parsing.ParseInt(Cam.Attributes["ColorBorde"].Value));
                                                // Quito el canal alfa
                                                NuevoCampo.ColorBorde = System.Drawing.Color.FromArgb(255, Col);
                                        }
                                        if (Cam.Attributes["ColorTexto"] != null) {
                                                Color Col = System.Drawing.Color.FromArgb(Lfx.Types.Parsing.ParseInt(Cam.Attributes["ColorTexto"].Value));
                                                // Quito el canal alfa
                                                NuevoCampo.ColorTexto = System.Drawing.Color.FromArgb(255, Col);
                                        }
                                        if (Cam.Attributes["ColorFondo"] != null) {
                                                Color Col = System.Drawing.Color.FromArgb(Lfx.Types.Parsing.ParseInt(Cam.Attributes["ColorFondo"].Value));
                                                // Quito el canal alfa
                                                if (Col == Color.FromArgb(0, 0, 0, 0))
                                                        NuevoCampo.ColorFondo = Color.Transparent;
                                                else
                                                        NuevoCampo.ColorFondo = System.Drawing.Color.FromArgb(255, Col);
                                        }
                                        NuevoCampo.Rectangle.X = Lfx.Types.Parsing.ParseInt(Cam.Attributes["X"].Value);
                                        NuevoCampo.Rectangle.Y = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Y"].Value);
                                        NuevoCampo.Rectangle.Width = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Ancho"].Value);
                                        NuevoCampo.Rectangle.Height = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Alto"].Value);
                                        if (Cam.Attributes["AlineacionRenglon"] != null) {
                                                switch (Cam.Attributes["AlineacionRenglon"].Value) {
                                                        case "Far":
                                                                NuevoCampo.LineAlignment = System.Drawing.StringAlignment.Far;
                                                                break;
                                                        case "Center":
                                                                NuevoCampo.LineAlignment = System.Drawing.StringAlignment.Center;
                                                                break;
                                                        default:
                                                                NuevoCampo.LineAlignment = System.Drawing.StringAlignment.Near;
                                                                break;
                                                }
                                        }
                                        if (Cam.Attributes["Alineacion"] != null) {
                                                switch (Cam.Attributes["Alineacion"].Value) {
                                                        case "Far":
                                                                NuevoCampo.Alignment = System.Drawing.StringAlignment.Far;
                                                                break;
                                                        case "Center":
                                                                NuevoCampo.Alignment = System.Drawing.StringAlignment.Center;
                                                                break;
                                                        default:
                                                                NuevoCampo.Alignment = System.Drawing.StringAlignment.Near;
                                                                break;
                                                }
                                        }
                                        if (Cam.Attributes["Fuente"] != null && Cam.Attributes["TamanoFuente"] != null) {
                                                float TamanoFuenteCampo = ((float)(Lfx.Types.Parsing.ParseDecimal(Cam.Attributes["TamanoFuente"].Value)));
                                                NuevoCampo.Font = new System.Drawing.Font(Cam.Attributes["Fuente"].Value, TamanoFuenteCampo);
                                        }
                                        if (Cam.Attributes["Wrap"] != null)
                                                NuevoCampo.Wrap = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Wrap"].Value) != 0;

                                        if (Cam.Attributes["Preimpreso"] != null)
                                                NuevoCampo.Preimpreso = Lfx.Types.Parsing.ParseInt(Cam.Attributes["Preimpreso"].Value) != 0;
                                        this.Campos.Add(NuevoCampo);
                                }
                        }
                }