/// <summary> /// Sets the report to view in the control /// </summary> /// <param name="report"></param> public void SetReport(Rdl.Render.GenericRender report) { if (report == null) { _htmlReport = null; return; } // Render the report to streaming html _htmlReport = new Rdl.Render.RenderToHtml(); _htmlReport.ImageUrl += new Rdl.Render.RenderToHtml.ImageUrlEventHandler(htmlRender_ImageUrl); _htmlReport.Render(report); Page.Session[ReportSessionID] = _htmlReport; // OnLoad(null); if (_htmlReport != null) { Page.Header.Controls.Add(new LiteralControl( "<style type='text/css'>\n" + _htmlReport.Style + "</style>")); } string cbReference = Page.ClientScript.GetCallbackEventReference( this, "arguments", "ToggleStateData", ""); Page.ClientScript.RegisterClientScriptBlock( this.GetType(), "ToggleState", "function ToggleStateCallback(arguments) {" + cbReference + "}", true); }
public void Render(Rdl.Render.GenericRender rpt) { rpt.SetSizes(false); TopMargin = rpt.Report.TopMargin.points; BottomMargin = rpt.Report.BottomMargin.points; LeftMargin = rpt.Report.LeftMargin.points; RightMargin = rpt.Report.RightMargin.points; PageWidth = rpt.Report.PageWidth.points; // Give the height a bit of breathing room because if we try to be exact // some browsers will put in extra blank pages. PageHeight = rpt.Report.PageHeight.points - 7.2m; _top = rpt.Report.TopMargin.points; _left = rpt.Report.LeftMargin.points; _width = rpt.Report.PageWidth.points - rpt.Report.RightMargin.points - rpt.Report.LeftMargin.points; _height = rpt.Report.PageHeight.points - rpt.Report.TopMargin.points - rpt.Report.BottomMargin.points; _pageList = new List <Page>(); Container b = null; Page p = new Page( rpt, 0, rpt.BodyContainer.Width, //PageWidth - RightMargin - LeftMargin, PageHeight - TopMargin - BottomMargin, 0, null, ref b); _pageList.Add(p); RecurseRender(rpt, rpt.BodyContainer, ref b, ref p, 0, rpt.BodyContainer.Top, 0, 0); //p.AddFooters(rpt, null, true); p.RemoveLastPageHeadersAndFooters(rpt); p.ResolveReportItemReferences(); }
public string Render(Rdl.Render.GenericRender report) { report.SetSizes(true); _rows = new List <TextLine>(); RecurseBuildRows(report.BodyContainer, 0, 0); _rows.Sort(delegate(TextLine d1, TextLine d2) { return(decimal.Compare(d1.pos, d2.pos)); }); StringBuilder sb = new StringBuilder(); foreach (TextLine t in _rows) { t.text.Sort(delegate(TextPoint d1, TextPoint d2) { return(decimal.Compare(d1.pos, d2.pos)); }); bool first = true; foreach (TextPoint p in t.text) { if (!first) { sb.Append(","); } first = false; sb.Append("\"" + p.text.Replace("\"", "\"\"").TrimEnd() + "\""); } sb.AppendLine(); } return(sb.ToString()); }
protected int AddStyles(Rdl.Render.GenericRender rpt, int styleBase) { for (int i = 0; i < rpt.StyleList.Count; i++) { AddStyle(rpt.StyleList[i], styleBase + i); } return(rpt.StyleList.Count); }
internal Page(Rdl.Render.GenericRender rpt, int pageNumber, decimal width, decimal height, decimal relativeTop, Container breakAt, ref Container currentPos) : base(null, null, null) { Width = width; Height = height; CanGrowVertically = false; Name = "Page"; _pageNumber = pageNumber; _relativeTop = relativeTop; _genericRender = rpt; _pageHeaderBox = AddFixedContainer(rpt.Report, rpt.Report.Style, null); _pageHeaderBox.Width = Width; _pageHeaderBox.Name = "PageHeader"; _pageHeaderBox.CanGrowVertically = true; // Add in the page header if appropriate if (rpt.Report.PageHeader != null) { if (pageNumber > 0 || rpt.Report.PageHeader.PrintOnFirstPage) { _pageHeaderBox.Children.Add(PageRender.Copy(rpt.PageHeaderContainer, true)); } } _pageHeaderBox.SetSizes(false); _pageDetailsBox = AddFixedContainer(rpt.Report, rpt.Report.Style, null); _pageDetailsBox.Width = Width; _pageDetailsBox.Height = Height; _pageDetailsBox.Name = "PageDetails"; _pageDetailsBox.CanGrowVertically = false; _pageFooterBox = AddFixedContainer(rpt.Report, rpt.Report.Style, null); _pageFooterBox.Width = Width; _pageFooterBox.Name = "PageFooter"; _pageFooterBox.CanGrowVertically = true; if (breakAt != null) { AddHeaders(breakAt); } AddFooters(rpt, _pageFooterBox); _pageDetailsBox.Height = Height - _pageHeaderBox.Height - _pageFooterBox.Height; _pageDetailsBox.Top = _pageHeaderBox.Height; currentPos = AddParentBoxes(breakAt, _pageDetailsBox); }
private decimal ElementWidth(Rdl.Render.GenericRender rpt, Element elmt) { decimal width = elmt.TotalWidth(false); BoxStyle bs = rpt.StyleList[elmt.StyleIndex]; if (bs.BorderStyle.Left != Rdl.Engine.BorderStyle.BorderStyleEnum.None) { width -= bs.BorderWidth.Left.points; } if (bs.BorderStyle.Right != Rdl.Engine.BorderStyle.BorderStyleEnum.None) { width -= bs.BorderWidth.Right.points; } width -= bs.PaddingLeft.points; width -= bs.PaddingRight.points; return(width); }
public void RemoveLastPageHeadersAndFooters(Rdl.Render.GenericRender rpt) { if (rpt.Report.PageHeader != null) { if (!rpt.Report.PageHeader.PrintOnLastPage) { _childElements.Remove(_pageHeaderBox); } } if (rpt.Report.PageFooter != null) { if (!rpt.Report.PageFooter.PrintOnLastPage) { _childElements.Remove(_pageFooterBox); } } }
private decimal ElementHeight(Rdl.Render.GenericRender rpt, Element elmt) { decimal height = elmt.TotalHeight(false); BoxStyle bs = rpt.StyleList[elmt.StyleIndex]; if (bs.BorderStyle.Top != Rdl.Engine.BorderStyle.BorderStyleEnum.None) { height -= bs.BorderWidth.Top.points; } if (bs.BorderStyle.Bottom != Rdl.Engine.BorderStyle.BorderStyleEnum.None) { height -= bs.BorderWidth.Bottom.points; } height -= bs.PaddingTop.points; height -= bs.PaddingBottom.points; return(height); }
public string Render(Rdl.Render.GenericRender rpt, PageRender pageRender) { _doc = new Document(); _pageRender = pageRender; _bm = new Bitmap(1000, 1000); _g = Graphics.FromImage(_bm); _g.PageUnit = GraphicsUnit.Point; // Create the fonts used in the report. int ct = rpt.StyleList.Count; _pdfFontList = new Pdf.Font[ct]; _winFontList = new System.Drawing.Font[ct]; for (int i = 0; i < ct; i++) { if (rpt.StyleList[i] is TextStyle) { TextStyle ts = rpt.StyleList[i] as TextStyle; _winFontList[i] = ts.GetWindowsFont(); _pdfFontList[i] = new Pdf.Font(_doc, "F" + i.ToString(), _winFontList[i]); } } // Loop through the pages in the document rendering the pages to PDF. for (int pageNum = 0; pageNum < pageRender.Pages.Count; pageNum++) { Pdf.Page pdfPage = _doc.Pages.AddPage(_doc, new Rectangle(0, 0, (int)_pageRender.PageWidth, (int)_pageRender.PageHeight)); Page renderedPage = pageRender.Pages[pageNum]; Pdf.ContentStream cs = pdfPage.AddContents(_doc); foreach (Element elmt in pageRender.Pages[pageNum].Children) { RecurseRender(elmt, cs, pageRender.TopMargin, pageRender.LeftMargin); } } return(_doc.ToString()); }
public void Render(Rdl.Render.GenericRender report, PageRender pageRender, bool forPrint) { _sourceReport = report; _styles.AppendLine("@page {"); _styles.AppendLine(" size: " + (pageRender.PageWidth / 72m).ToString() + "in " + (pageRender.PageHeight / 72m).ToString() + "in;"); _styles.AppendLine(" margin-left: " + (pageRender.LeftMargin / 72m).ToString() + "in;"); _styles.AppendLine(" margin-right: " + (pageRender.RightMargin / 72m).ToString() + "in;"); _styles.AppendLine(" margin-top: " + (pageRender.TopMargin / 72m).ToString() + "in;"); _styles.AppendLine(" margin-bottom: " + (pageRender.BottomMargin / 72m).ToString() + "in;"); _styles.AppendLine(" padding: 0in;"); _styles.AppendLine("}"); _styles.AppendLine(".pagediv {"); //_styles.AppendLine(" width: " + pageRender.PageWidth.ToString() + "pt;"); //_styles.AppendLine(" height: " + pageRender.PageHeight.ToString() + "pt;"); _styles.AppendLine("}"); int styleTop = AddStyles(report, 0); //RecurseAddStyles(report.PageHeaderContainer, 0, ref styleTop); //RecurseAddStyles(report.PageFooterContainer, 0, ref styleTop); //RecurseAddStyles(report.BodyContainer, 0, ref styleTop); //for (int pageNum = 0; pageNum < pageRender.Pages.Count; pageNum++) // RecurseAddStyles(pageRender.Pages[pageNum], 0, ref styleTop); decimal top = 0; for (int pageNum = 0; pageNum < pageRender.Pages.Count; pageNum++) { Page page = pageRender.Pages[pageNum]; _body.AppendLine("<div " + //class=\"pagediv\" " + "style=\"position: static;" + ((pageNum + 1 < pageRender.Pages.Count) ? "page-break-after: always;" : string.Empty) + "\" " + "title=\"page " + (pageNum + 1).ToString() + "\">"); foreach (Rdl.Render.Element elmt in pageRender.Pages[pageNum].Children) { RecurseRender(report, _body, elmt, 1, forPrint); } _body.AppendLine("</div>"); top += pageRender.PageHeight; } }
public byte[] Render(Rdl.Render.GenericRender report, bool renderAll) { _report = report; MemoryStream ms = new MemoryStream(); report.SetSizes(renderAll); _workbook = Workbook.createWorkbook(ms); //_workbook = Workbook.createWorkbook(new System.IO.FileInfo(@"c:\foo.xls")); _ws = _workbook.createSheet("Sheet 1", 0); RecurseBuildRowsCols(report.BodyContainer, 0, 0, renderAll); _rows.Add(0); _rows.Sort(delegate(decimal d1, decimal d2) { return(decimal.Compare(d1, d2)); }); _cols.Add(0); _cols.Sort(delegate(decimal d1, decimal d2) { return(decimal.Compare(d1, d2)); }); for (int i = 1; i < _rows.Count; i++) { _ws.setRowView(i - 1, (int)((_rows[i] - _rows[i - 1]) * _lineHeight)); } for (int i = 1; i < _cols.Count; i++) { _ws.setColumnView(i - 1, (int)((_cols[i] - _cols[i - 1]) * _colWidth)); } formats = new WritableCellFormat[report.StyleList.Count]; for (int i = 0; i < report.StyleList.Count; i++) { if (report.StyleList[i] is TextStyle) { formats[i] = GetWritableFormat((TextStyle)report.StyleList[i]); } } RecurseRender(report.BodyContainer, 0, 0, renderAll); _workbook.write(); _workbook.close(); //BIFF8Writer.WriteWorkbookToStream(_workbook, ms); return(ms.ToArray()); }
public string Render(Rdl.Render.GenericRender report) { report.SetSizes(true); RecurseBuildRows(report.BodyContainer, 0); _rows.Add(0); _rows.Sort(delegate(decimal d1, decimal d2) { return(decimal.Compare(d1, d2)); }); // Convert the list of text positions into text lines assuming 12 points per line. _rowsToLines = new int[_rows.Count]; int line = 0; decimal lastPos = 0; for (int i = 0; i < _rows.Count; i++) { int lineAdd = (int)((_rows[i] - lastPos) / 24); line += lineAdd; _rowsToLines[i] = line; lastPos = _rows[i]; line++; } _lines = new string[line]; // Render the report onto _lines. RecurseRender(report.BodyContainer, 0, 0); StringBuilder sb = new StringBuilder(); for (Int32 i = 0; i < line; i++) { if (_lines[i] == null) { sb.AppendLine(); } else { sb.AppendLine(_lines[i]); } } return(sb.ToString()); }
internal void AddFooters(Rdl.Render.GenericRender rpt, Container b) { decimal top = 0; //_pageFooterBox.Top = _pageHeaderBox.Height + _pageDetailsBox.Height; if (b != null) { RecurseAddFooters(b, ref top); } if (rpt.Report.PageFooter != null) { Container pageFooter = PageRender.Copy(rpt.PageFooterContainer, true); pageFooter.Top = top; _pageFooterBox.Children.Add(pageFooter); top += pageFooter.Height; } _pageFooterBox.Height = top; _pageFooterBox.Top = Height - top; }
public void Render(Rdl.Render.GenericRender report, bool forPrint) { //_body.AppendLine("<div style=\"height:" + report.Width + "pt; width:" + report.Width + "pt;\">"); _styles.Length = 0; _script.Length = 0; _plusGif = GetImageUrl("", "resource", "plus.gif"); _minusGif = GetImageUrl("", "resource", "minus.gif"); _sourceReport = report; int styleTop = AddStyles(report, 0); //RecurseAddStyles(report.PageHeaderContainer, 0, ref styleTop); //RecurseAddStyles(report.PageFooterContainer, 0, ref styleTop); //RecurseAddStyles(report.BodyContainer, 0, ref styleTop); //int styleBase = AddStyles(report); _styles.AppendLine("a { color: inherit; background-color: inherit;}"); RenderBody(forPrint); //_body.AppendLine("</div>"); }
// Render element elmt onto the page currentPage. // parent refers to the parent element within the current rendered page. When // a page break occurs a new parent hierarchy is build for the new page // and parent will point to the bottom of the new parent hierarchy. // currentPage will refer to the current page being built. It will be updated // inside this routine if elmt spans pages. private void RecurseRender( Rdl.Render.GenericRender rpt, Element elmt, // The current element from the source document ref Container parent, // The parent element in the page. ref Page currentPage, // The current page. decimal parentTop, // The absolute position of the parent element in the master rendered document. decimal top, // The absolute position in the master rendered document. decimal xPos, // The X position within the parent object decimal yPos // The Y position within the parent object ) { //decimal elementHeight = CalcHeight(elmt); decimal elementHeight = elmt.Height; decimal requiredHeight = elementHeight; decimal elementTop; // If this element has repeated elements associated with it then make sure // that there is room on the page for those repeated elements. if (elmt is Container) { // If this is a toggle item, then determine if we want to include it in the // rendered page. if (!((Container)elmt).IsVisible) { return; } foreach (Container re in ((Container)elmt).RepeatList) { if (re.AbsoluteTop > elmt.AbsoluteTop) { requiredHeight += re.Height; } //requiredHeight += CalcHeight(re); } } // If this element is spanning pages, then calculate the top // based on the starting position of this page. if (parentTop < currentPage.RelativeTop) { elementTop = yPos - (currentPage.RelativeTop - parentTop); } else { elementTop = yPos; } bool newPage = false; if (elmt is Container && ((Container)elmt).PageBreakBefore) { newPage = true; } else if (top - currentPage.RelativeTop + requiredHeight > currentPage.AvailableHeight) { // If the element doesn't fit entirely on this page and we should keep it on // one page, then create a new page. if (!(elmt is Container) || (elmt is Container && ((Container)elmt).KeepTogether)) { newPage = true; } } if (newPage) { //currentPage.AddFooters(rpt, parent, false); currentPage.ResolveReportItemReferences(); currentPage = new Page( rpt, currentPage.PageNumber + 1, rpt.BodyContainer.Width, //PageWidth - RightMargin - LeftMargin, PageHeight - TopMargin - BottomMargin, top, elmt.Parent, ref parent); _pageList.Add(currentPage); if (parentTop < currentPage.RelativeTop) { elementTop = yPos - (currentPage.RelativeTop - parentTop); } else { elementTop = yPos; } } Element newElement = null; if (elmt is Container) { newElement = Copy(((Container)elmt), false); newElement.CanGrowVertically = true; // Loop through the repeated elements foreach (Container r in ((Container)elmt).RepeatList) { // If the repeated element is below the current element then reserve space for it at the bottom. if (r.AbsoluteTop > elmt.AbsoluteTop) { currentPage.FooterSpace += (r.Top - yPos + elementHeight + r.Height); } } //currentPage.FooterSpace += (r.Top - yPos + elementHeight + CalcHeight(r)); } if (elmt is TextElement) { TextElement te = (TextElement)elmt; // Save the report item value for filling in to ReportItem references later if (te.ReportElement is Rdl.Engine.ReportItem) { currentPage.elementValues[((Rdl.Engine.ReportItem)te.ReportElement).Name] = te.Text; } newElement = new TextElement(te); } if (elmt is ImageElement) { newElement = new ImageElement((ImageElement)elmt); } if (elmt is ChartElement) { newElement = new ChartElement((ChartElement)elmt); } newElement.Parent = parent; newElement.Top = 0; newElement.Height = 0; //newElement.Left += xPos; if (parent != null) { parent.Children.Add(newElement); } // Set the height of this element to either the height of the source element // or the height of the remaining space on the page. Whichever is less. newElement.Top = elementTop; newElement.Height = Math.Min(elementHeight, currentPage.AvailableHeight - (top - currentPage.RelativeTop)); if (elmt is Container) { Container be = newElement as Container; // Sort the children by the top values so if the children span a page then // they will render in the correct order. if (elmt is FixedContainer) { ((Container)elmt).Children.Sort(delegate(Element a, Element b) { return(a.Top.CompareTo(b.Top)); }); } foreach (Element child in ((Container)elmt).Children) { RecurseRender(rpt, child, ref be, ref currentPage, top, top + child.Top, child.Left, child.Top); parent = be.Parent; } // Loop through the repeated elements foreach (Container r in be.RepeatList) { // If the repeated element is below the current element then release the reserved space if (r.AbsoluteTop > be.AbsoluteTop) { currentPage.FooterSpace -= (r.Top - elmt.Top + elementHeight + r.Height); } } //currentPage.FooterSpace -= (r.Top - elmt.Top + elementHeight + CalcHeight(r)); if (be.PageBreakAfter) { //currentPage.AddFooters(rpt, parent, false); currentPage.ResolveReportItemReferences(); currentPage = new Page( rpt, currentPage.PageNumber + 1, rpt.BodyContainer.Width, //PageWidth - RightMargin - LeftMargin, PageHeight - TopMargin - BottomMargin, elmt.Top + elementHeight, elmt.Parent, ref parent); _pageList.Add(currentPage); } } }
void btnAction_Click(object sender, EventArgs e) { if (FindControl("tbAction") != null) { // Get the ID of the element which triggered the action string actionID = ((HiddenField)FindControl("tbAction")).Value; // Prevent recursion if (actionID != string.Empty) { // Find the named text action element. Rdl.Render.ActionElement ae = (Rdl.Render.ActionElement)_htmlReport.SourceReport.BodyContainer.FindNamedElement(actionID); if (ae != null) { // If the action is a drill-through, then load the new report, // set the parameters and open the report. if (ae.DrillThroughReportName != null) { string reportName = ae.DrillThroughReportName; Rdl.Engine.Report rpt; System.Runtime.Remoting.ObjectHandle oh = null; try { oh = Activator.CreateInstance(reportName, "Rdl.Runtime." + reportName.Replace(' ', '_')); } catch { } if (oh != null) { rpt = ((Rdl.Runtime.RuntimeBase)oh.Unwrap()).Report; } else { if (!reportName.Contains("\\")) { reportName = _htmlReport.SourceReport.Report.ReportPath + reportName; } if (!reportName.Contains(".rdl")) { if (File.Exists(reportName + ".rdl")) { reportName += ".rdl"; } else if (File.Exists(reportName + ".rdlc")) { reportName += ".rdlc"; } } if (!File.Exists(reportName)) { throw new Exception("Unable to locate sub report " + reportName); } rpt = new Rdl.Engine.Report(); FileStream fs = new FileStream(reportName, FileMode.Open, FileAccess.Read, FileShare.Read); rpt.Load(fs, _htmlReport.SourceReport.Report.ReportPath); fs.Close(); fs.Dispose(); } foreach (Rdl.Render.ActionElement.ActionParameter parm in ae.DrillThroughParameterList) { rpt.ReportParameters[parm.Name].Value = parm.Value; rpt.ReportParameters[parm.Name].Hidden = true; } Rdl.Render.GenericRender render = rpt.Run(); _reportSessionID = "RenderedReport_" + (reportIndex++).ToString(); ((HiddenField)FindControl("tbReportID")).Value = _reportSessionID; SetReport(render); return; } } } } }
protected int RecurseRender(Rdl.Render.GenericRender rpt, StringBuilder body, Element elmt, int level, bool forPrint) { StringBuilder bodyPart = new StringBuilder(); bool hasAction = false; string style = string.Empty; //BoxStyle bs = rpt.StyleList[elmt.StyleIndex]; //if (elmt.ReportElement is Rdl.Engine.Report) //{ // rpt = (Rdl.Engine.Report)elmt.ReportElement; //} if (elmt is Container) { Container c = elmt as Container; if (!c.IsVisible) { return(0); } } if ((elmt is TextElement || elmt is FixedContainer || elmt is ImageElement || elmt is ChartElement)) { style += "width: " + ElementWidth(rpt, elmt) + "pt;" + "height: " + ElementHeight(rpt, elmt) + "pt;"; } if (elmt is TextElement) { style += "overflow: hidden;"; } if (elmt._imageIndex >= 0 && !(elmt is ImageElement)) { style += "background-image: url(" + GetImageUrl(elmt.Name, "StaticImage", elmt._imageIndex.ToString()) + ");"; style += "background-repeat: " + rpt.ImageList[elmt._imageIndex].ImageRepeat.ToString() + ";"; } if (elmt.Parent != null && elmt.Parent is Rdl.Render.FixedContainer) { decimal top = elmt.Top; decimal left = elmt.Left; style += "top: " + top + "pt;" + "left: " + left + "pt;"; // 12/26/2007 This line caused problems with tables. //if (!elmt.MatchParentHeight) style += "position: absolute;"; } if (elmt is TextElement && ((TextStyle)elmt.Style).TextAlign == Rdl.Engine.Style.TextAlignEnum.General) { TextElement te = elmt as TextElement; decimal val; if (te.Text.Length > 0 && decimal.TryParse(te.Text, System.Globalization.NumberStyles.AllowCurrencySymbol | System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.CurrentCulture, out val)) { style += "text-align: right;"; } else { style += "text-align: left;"; } } if (elmt is FlowContainer && ((FlowContainer)elmt).FlowDirection == FlowContainer.FlowDirectionEnum.LeftToRight) { int elements = 0; bodyPart.AppendLine(Spaces(level) + "<table cellpadding=\"0\" cellspacing=\"0\" " + "id=\"" + elmt.Name + "\" " + ((elmt.StyleIndex >= 0) ? "class=\"Report_style" + elmt.StyleIndex + "\" " : string.Empty) + "style=\"" + style + "\"" + ">" + "<tr>"); foreach (Element child in ((Container)elmt).Children) { bodyPart.AppendLine(Spaces(level + 1) + "<td>"); elements += RecurseRender(rpt, bodyPart, child, level + 2, forPrint); bodyPart.AppendLine(Spaces(level + 1) + "</td>"); } bodyPart.AppendLine(Spaces(level) + "</tr></table>"); if (elements > 0) { body.Append(bodyPart.ToString()); } return(elements); } if (elmt is Container || elmt is TextElement || elmt is ImageElement || elmt is ChartElement) { string divTag = "<div " + "id=\"" + elmt.Name + "\" " + ((elmt.StyleIndex >= 0) ? "class=\"Report_style" + elmt.StyleIndex.ToString() + "\" " : string.Empty) + "style=\"" + style + "\""; if (elmt is TextElement && ((TextElement)elmt).IsToggle) { divTag += " stateToggle=\"" + ((TextElement)elmt).ToggleState.ToString() + "\""; } divTag += ">"; bodyPart.AppendLine(Spaces(level) + divTag); } if (elmt is TextElement) { TextElement te = elmt as TextElement; if (te.IsToggle && !forPrint) { bodyPart.AppendLine(Spaces(level + 1) + "<a href=\"javascript:{}\" onclick=\"javascript:ToggleState('" + te.Name + "');\">"); bodyPart.AppendLine(Spaces(level + 1) + "<img id=\"" + te.Name + "_img\" src=" + ((te.ToggleState == TextElement.ToggleStateEnum.open) ? _minusGif : _plusGif) + " border=\"0\" style=\"float: left;\" />"); bodyPart.AppendLine(Spaces(level + 1) + "</a>"); } } if (elmt is ActionElement) { ActionElement ae = (ActionElement)elmt; if (ae.DrillThroughReportName != null) { bodyPart.AppendLine(Spaces(level + 1) + "<a href=\"javascript:{}\" onclick=\"javascript:Action('" + ae.Name + "');\">"); hasAction = true; } else if (ae.Hyperlink != null) { bodyPart.AppendLine(Spaces(level + 1) + "<a href=\"" + ae.Hyperlink + "\" >"); hasAction = true; } else if (ae.BookmarkLink != null) { bodyPart.AppendLine(Spaces(level + 1) + "<a href=\"#" + ae.BookmarkLink + "\" >"); hasAction = true; } } if (elmt is TextElement) { TextElement te = elmt as TextElement; // Save the report item value for filling in to ReportItem references later if (te.ReportElement is Rdl.Engine.ReportItem) { elementValues[((Rdl.Engine.ReportItem)te.ReportElement).Name] = te.Text; } string text = te.Text.Replace("\n", "<br />"); bodyPart.AppendLine(Spaces(level) + text); } if (elmt is ImageElement) { ImageElement ie = elmt as ImageElement; bodyPart.AppendLine(Spaces(level) + "<img id=\"img_" + elmt.Name + "\" alt=\"\" border=\"0\" src=\"\">"); _script.AppendLine(Spaces(level) + "document.getElementById('img_" + elmt.Name + "').src = " + GetImageUrl(elmt.Name, "SizedImage", elmt._imageIndex.ToString()) + ";" ); } if (elmt is ChartElement) { _charts.Add(elmt.Name, (ChartElement)elmt); bodyPart.AppendLine(Spaces(level) + "<img id=\"img_" + elmt.Name + "\" alt=\"\" border=\"0\" src=\"\">"); _script.AppendLine(Spaces(level) + "document.getElementById('img_" + elmt.Name + "').src = " + GetImageUrl(elmt.Name, "Chart", elmt.Name) + ";" ); } if (elmt is Container) { if (elmt.Height == 0) { return(0); } int elements = 0; foreach (Element child in ((Container)elmt).Children) { elements += RecurseRender(rpt, bodyPart, child, level + 1, forPrint); } } if (hasAction) { bodyPart.Append("</a>"); } if (elmt is Container || elmt is TextElement || elmt is ImageElement || elmt is ChartElement) { bodyPart.AppendLine(Spaces(level) + "</div>"); } body.Append(bodyPart.ToString()); return(1); }
public void Render(Rdl.Render.GenericRender rpt) { Render(rpt, false); }