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; } } }
public void PrintBookmark(Bookmark b, PdfDocument pdf) { pdf.MakeOutline(pdf.OutlineRoot, b.VarName, currentPage); }