コード例 #1
0
ファイル: Page.cs プロジェクト: ademar/melon-reports
        public void PutBand(Band band, int h)
        {
            foreach (var current in band.Elements)
            {
                if (current is Text)
                {
                    var t1 = (Text)current;
                    var t2 = new Text(t1.Label, t1.Align, t1.X, t1.Y) {FontSize = t1.FontSize, rgbColor = t1.rgbColor};

                    AddElement(t2, h);
                }
                else if (current is Expression)
                {
                    var e1 = (Expression)current;

                    var t2 = new Text(e1.Value.ToString(), TextAlignment.Left, e1.X, e1.Y)
                             	{
                             		FontSize = e1.FontSize,
                             		rgbColor = new RgbColor("#000000")
                             	};
                    AddElement(t2, h);
                }
                else if (current is Image)
                {
                    AddElement(current, h);
                }
                else if (current is Rectangle)
                {
                    var r1 = (Rectangle)current;

                    var r2 = new Rectangle
                             	{
                             		x = r1.x,
                             		y = r1.y,
                             		height = r1.height,
                             		width = r1.width,
                             		bordercolor = r1.bordercolor,
                             		fillcolor = r1.fillcolor
                             	};

                    AddElement(r2, h);
                }
                else if (current is Bookmark)
                {
                    AddElement(current, h);
                }
            }
        }
コード例 #2
0
ファイル: Parser.cs プロジェクト: ademar/melon-reports
        private static BandCollection ParseBands(XmlReader reader, string endTag, Report report)
        {
            var bands = new BandCollection();

            while (reader.Read())
            {
                if (reader.Name.Equals(endTag) && (reader.NodeType == XmlNodeType.EndElement))
                    break;
                if (reader.Name == "Band" && reader.NodeType == XmlNodeType.Element)
                {
                    var band = new Band(XmlConvert.ToInt16(reader.GetAttribute("height"))) {parent = report};
                    bands.Add(band);
                    ParseBand(reader, band, report);
                }
            }

            return bands;
        }
コード例 #3
0
ファイル: Parser.cs プロジェクト: ademar/melon-reports
        private static void ParseBand(XmlReader reader, Band band, Report report)
        {
            while (reader.Read())
            {
                if (reader.Name.Equals("Band") && (reader.NodeType == XmlNodeType.EndElement)) break;
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        int x;
                        int y;
                        int fontSize;
                        int height;
                        int width;
                        switch (reader.Name)
                        {
                            case "StaticText":
                                x = XmlConvert.ToInt16(reader.GetAttribute("x"));
                                y = XmlConvert.ToInt16(reader.GetAttribute("y"));
                                fontSize = XmlConvert.ToInt16(reader.GetAttribute("font-size"));
                                var color = reader.GetAttribute("color");
                                var content = reader.ReadString();
                                var t = new Text(content, TextAlignment.Left, x, y) {FontSize = fontSize, rgbColor = new RgbColor(color)};
                                band.Elements.Add(t);
                                break;
                            case "Expression":
                                x = XmlConvert.ToInt16(reader.GetAttribute("x"));
                                y = XmlConvert.ToInt16(reader.GetAttribute("y"));
                                fontSize = XmlConvert.ToInt16(reader.GetAttribute("font-size"));
                                var strtype = reader.GetAttribute("type");
                                var e = new Expression(reader.ReadString()) {X = x, Y = y, FontSize = fontSize, Type = strtype};
                                band.Elements.Add(e);
                                band.parent.Expressions.Add(e);
                                break;
                            case "Image":
                                x = XmlConvert.ToInt16(reader.GetAttribute("x"));
                                y = XmlConvert.ToInt16(reader.GetAttribute("y"));
                                height = XmlConvert.ToInt16(reader.GetAttribute("height"));
                                width = XmlConvert.ToInt16(reader.GetAttribute("width"));
                                var url = reader.GetAttribute("href");
                                var i = (Image) report.ImageCollection[url];
                                var i2 = new Image(url, x, y) {width = width, height = height, ImageName = i.ImageName};
                                band.Elements.Add(i2);
                                break;
                            case "Rectangle":
                                x = XmlConvert.ToInt16(reader.GetAttribute("x"));
                                y = XmlConvert.ToInt16(reader.GetAttribute("y"));
                                height = XmlConvert.ToInt16(reader.GetAttribute("height"));
                                width = XmlConvert.ToInt16(reader.GetAttribute("width"));

                                var bordercolor = reader.GetAttribute("bordercolor");
                                var fillcolor = reader.GetAttribute("fillcolor");

                                var r = new Rectangle
                                              	{
                                              		x = x,
                                              		y = y,
                                              		width = width,
                                              		height = height,
                                              		bordercolor = new RgbColor(bordercolor),
                                              		fillcolor = new RgbColor(fillcolor)
                                              	};
                                band.Elements.Add(r);
                                break;
                            case "Bookmark":
                                var var = reader.GetAttribute("var");
                                var id = reader.GetAttribute("id");
                                var b = new Bookmark(var);
                                band.Elements.Add(b);
                                break;
                        }
                        break;
                }
            }
        }
コード例 #4
0
ファイル: Generator.cs プロジェクト: ademar/melon-reports
 private void appendBand(Page page, Band band)
 {
     page.PutBand(band, h);
     h -= band.Height;
 }
コード例 #5
0
 public void Add(Band band)
 {
     Bands.Add(band); Height += band.Height;
 }