//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Renders this object as an RDL MatrixRow to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XmlWriter to render the object to.</param> public void Render(XmlWriter xmlWriter) { string TextboxValue = ""; if (_isSummable) { if (_groupingLevel == 0) { TextboxValue = "=Sum(Fields!" + _fieldName + ".Value)"; } else { TextboxValue = @"=Sum(iif(Fields!GroupingLevel.Value <= " + _groupingLevel + ", cdbl(Fields!" + _fieldName + ".Value), cdbl(0)))"; } } _textboxStyle.Format = RdlFormatter.FormatData(_dataType); //TODO: Code Review Issue 11/05/05: indent the code as in XML to increase readability // Done 24/05/2005 xmlWriter.WriteStartElement("MatrixRow"); RdlRender.AddLine(xmlWriter, "Height", "1cm"); xmlWriter.WriteStartElement("MatrixCells"); xmlWriter.WriteStartElement("MatrixCell"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, _name, TextboxValue, _textboxStyle, "", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); // ReportItems xmlWriter.WriteEndElement(); // MatrixCell xmlWriter.WriteEndElement(); // MatrixCells xmlWriter.WriteEndElement(); // MatrixRow }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Renders this object as an RDL Textbox to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XmlWriter to render the object to.</param> public void Render(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, _name, "=Fields!" + _name + ".Value", _textboxStyle, "", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL Footer type to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { //TODO: Code Review Issue 11/05/05: indent the code as in XML to increase readability // Done 24/05/2005 ReportingServicesStyle _textboxStyle10pt = new ReportingServicesStyle( ReportingServicesStyle.TextBoxStyle.TabularReport10pt); //Footer start xmlWriter.WriteStartElement("Footer"); RdlRender.AddLine(xmlWriter, "RepeatOnNewPage", "true"); xmlWriter.WriteStartElement("TableRows"); //Report Description xmlWriter.WriteStartElement("TableRow"); xmlWriter.WriteStartElement("TableCells"); xmlWriter.WriteStartElement("TableCell"); xmlWriter.WriteStartElement("ColSpan"); xmlWriter.WriteString(_colSpan); xmlWriter.WriteEndElement(); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, "reportDescription", _reportDescription, _textboxStyle10pt, "", "0.25cm", "15.00cm", "3.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteEndElement(); //Report Filters foreach (ReportFilterBusinessObject _CurrentFilter in _filterItemList) { FilterCount++; _Filter = "Filter" + FilterCount.ToString(); xmlWriter.WriteStartElement("TableRow"); xmlWriter.WriteStartElement("TableCells"); xmlWriter.WriteStartElement("TableCell"); xmlWriter.WriteStartElement("ColSpan"); xmlWriter.WriteString(_colSpan); xmlWriter.WriteEndElement(); xmlWriter.WriteStartElement("ReportItems"); _FilterDescription = "Data Filter Applied : " + _CurrentFilter.DataItemCaption + " " + _CurrentFilter.Operand + " " + _CurrentFilter.FilterValue; RdlRender.AddTextbox(xmlWriter, _Filter, _FilterDescription, _textboxStyle10pt, "", "0.25cm", "15.00cm", "3.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); //ReportItems xmlWriter.WriteEndElement(); //Tablecell xmlWriter.WriteEndElement(); //Tablecells RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteEndElement(); //TableRow } //Footer end xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL TableCell type to an XmlWriter object. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("TableCell"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, "Header" + _name, _caption, _textboxStyle, "Center", "0in", "0in", ".5in", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Renders this object as an RDL Textbox to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XmlWriter to render the object to.</param> public void Render(XmlWriter xmlWriter) { //21/07/05 LL - TIR0200 - Align Column Heading with Details _textboxStyle.TextAlign = "Right"; xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, _name, "=Fields!" + _name + ".Value", _textboxStyle, "", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Renders this object as an RDL Subtotal to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XmlWriter to render the object to.</param> public void Render(XmlWriter xmlWriter) { //TODO: Code Review Issue 11/05/05: Indent blocks of code as in XML to increase readability. // Done 24/05/2005 xmlWriter.WriteStartElement("Subtotal"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, _name, "Total", _textboxStyle, "", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Renders this object as an RDL StaticRow to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XmlWriter to render the object to.</param> public void Render(XmlWriter xmlWriter) { //TODO: Code Review Issue 11/05/05: give comment and/or indent the code as in XML //to increase readability // Done 24/05/2005 xmlWriter.WriteStartElement("StaticRow"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, _name, _fieldName, _textboxStyle, "Right", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Renders this object as an RDL Subtotal to a XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XmlWriter to render the object to.</param> public void Render(XmlWriter xmlWriter) { //21/07/05 LL - TIR0200 Align Column Heading with Details _textboxStyle.TextAlign = "Right"; //TODO: Code Review Issue 11/05/05: Indent blocks of code as in XML to increase readability. xmlWriter.WriteStartElement("Subtotal"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, _name, "Total", _textboxStyle, "", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL TableCell to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { string TextboxValue = _isEmpty ? "" : "=Fields!" + _name + ".Value"; string Alignment = RdlFormatter.FormatAlignment(_dataType); _textboxStyle.Format = RdlFormatter.FormatData(_dataType); xmlWriter.WriteStartElement("TableCell"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, "Details" + _name, TextboxValue, _textboxStyle, Alignment, "0in", "0in", ".5in", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL TableCell to an XmlWriter object. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { string TextboxValue = ""; // If this textbox is empty and the data that its column represents may // be summed, then it displays the sum of the values in its column // that are within its group. if (_isEmpty) { /* TEMPORARILY REMOVED */ if (_isSummable) { if (_groupingLevel == 0) { TextboxValue = @"=Sum(Fields!" + _itemName + ".Value)"; } else { // Only give this textbox a value if the field this textbox is grouped by // is at a lower or equal grouping level than this textbox if (_newGroupListIndex <= _groupingLevel) { TextboxValue = @"=Sum(iif(Fields!GroupingLevel.Value <= " + _groupingLevel + ", cdbl(Fields!" + _itemName + ".Value), cdbl(0)), " + '\u0022' + "Grouping" + _groupName + '\u0022' + ")"; } } } /* */ } else { TextboxValue = "=Fields!" + _name + ".Value"; } _textboxStyle.Format = RdlFormatter.FormatData(_dataType); xmlWriter.WriteStartElement("TableCell"); xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(xmlWriter, "Group" + _name, TextboxValue, _textboxStyle, RdlFormatter.FormatAlignment(_dataType), "0in", "0in", ".5in", "true", "", "", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
/// <summary> /// Renders this MatrixReport in RDL. /// </summary> /// <returns>A Byte array containing the raw RDL data.</returns> public Byte[] Render() { //TODO: Code Review Issue 11/05/05: Add necessary comment on each code block and //indent the code as in XML where possible to increase readability // Done 24/05/2005 _xmlWriter.WriteStartDocument(); _xmlWriter.WriteStartElement("Report"); _xmlWriter.WriteAttributeString("xmlns", "http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"); RdlRender.AddLine(_xmlWriter, "Width", "1in"); RdlRender.AddLine(_xmlWriter, "PageWidth", "11.5in"); RdlRender.AddLine(_xmlWriter, "TopMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "BottomMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "LeftMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "RightMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "PageHeight", "7.9375in"); _xmlWriter.WriteStartElement("PageHeader"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddImage(_xmlWriter, "Image1", "2.59259cm", "3.8cm", "1.0cm", "Embedded", "Esf", "AutoSize"); RdlRender.AddTextbox(_xmlWriter, "TitleTextbox", "DWP Small Systems Ad Hoc Reporting System", _textboxStyle, "Left", "0.3cm", "5.0cm", "10cm", "true", "0.95cm", "2", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox(_xmlWriter, "PageHeader", "=Globals!ReportName", _textboxStyle, "Left", "2.85714cm", "1.26984cm", "14.92063cm", "true", "", "", "", "", "", "", "", "", "", ""); foreach (String _parameterName in _parameterList) { _parameterCount++; RdlRender.AddTextbox(_xmlWriter, "Parameter" + _parameterCount.ToString(), _parameterName, _textboxStyle, "Left", "2.85714cm", "1.26984cm", "14.92063cm", "true", "", "", "", "", "", "", "", "", "", ""); } _xmlWriter.WriteEndElement(); // ReportItems RdlRender.AddLine(_xmlWriter, "PrintOnLastPage", "true"); RdlRender.AddLine(_xmlWriter, "PrintOnFirstPage", "true"); RdlRender.AddLine(_xmlWriter, "Height", "1.375in"); _xmlWriter.WriteEndElement(); // PageHeader _xmlWriter.WriteStartElement("Body"); RdlRender.AddLine(_xmlWriter, "Height", "5in"); _xmlWriter.WriteStartElement("ReportItems"); // Add table of keys to dynamic rows/columns ReportingServicesStyle BoldBorderedTextBoxStyle = new ReportingServicesStyle(ReportingServicesStyle.TextBoxStyle.BoldBordered); // "", "Solid", "Black", "", "", "", "", "10pt", "Bold", "", "", "", ""); ReportingServicesStyle PlainBorderedTextBoxStyle = new ReportingServicesStyle(ReportingServicesStyle.TextBoxStyle.PlainBordered); // "", "Solid", "Black", "", "", "", "", "10pt", "", "", "", "", ""); // Table's header _xmlWriter.WriteStartElement("Table"); _xmlWriter.WriteAttributeString("Name", "KeyTable"); RdlRender.AddLine(_xmlWriter, "Left", "1.26984cm"); RdlRender.AddLine(_xmlWriter, "DataSetName", _matrixDataSetName + "DataSet"); _xmlWriter.WriteStartElement("Style"); _xmlWriter.WriteStartElement("BorderStyle"); RdlRender.AddLine(_xmlWriter, "Default", PlainBorderedTextBoxStyle.BorderStyle); _xmlWriter.WriteEndElement(); // BorderStyle _xmlWriter.WriteEndElement(); // Style _xmlWriter.WriteStartElement("Header"); _xmlWriter.WriteStartElement("TableRows"); _xmlWriter.WriteStartElement("TableRow"); RdlRender.AddLine(_xmlWriter, "Height", "1cm"); _xmlWriter.WriteStartElement("TableCells"); _xmlWriter.WriteStartElement("TableCell"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(_xmlWriter, "KeyTableRows", "Dynamic Rows", BoldBorderedTextBoxStyle, "Center", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // TableCell _xmlWriter.WriteStartElement("TableCell"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(_xmlWriter, "KeyTableColumns", "Dynamic Columns", BoldBorderedTextBoxStyle, "Center", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // TableCell _xmlWriter.WriteEndElement(); // TableCells _xmlWriter.WriteEndElement(); // TableRow // Add the names of the rows and columns to the table for (int RowNum = 0; RowNum < _columnTotalDataItemList.Count && RowNum < _rowTotalDataItemList.Count; RowNum++) { string ColumnItem = _columnTotalDataItemList[RowNum] != null ? (_columnTotalDataItemList[RowNum]).Caption : ""; string RowItem = _rowTotalDataItemList[RowNum] != null ? (_rowTotalDataItemList[RowNum]).Caption : ""; _xmlWriter.WriteStartElement("TableRow"); RdlRender.AddLine(_xmlWriter, "Height", "0.8cm"); _xmlWriter.WriteStartElement("TableCells"); _xmlWriter.WriteStartElement("TableCell"); _xmlWriter.WriteStartElement("ReportItems"); // Column text box RdlRender.AddTextbox(_xmlWriter, "KeyTableRow" + RowNum, RowItem, PlainBorderedTextBoxStyle, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // TableCell _xmlWriter.WriteStartElement("TableCell"); _xmlWriter.WriteStartElement("ReportItems"); // Row text box RdlRender.AddTextbox(_xmlWriter, "KeyTableColumn" + RowNum, ColumnItem, PlainBorderedTextBoxStyle, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // TableCell _xmlWriter.WriteEndElement(); // TableCells _xmlWriter.WriteEndElement(); // TableRow } _xmlWriter.WriteEndElement(); // TableRows _xmlWriter.WriteEndElement(); // Header _xmlWriter.WriteStartElement("TableColumns"); _xmlWriter.WriteStartElement("TableColumn"); RdlRender.AddLine(_xmlWriter, "Width", "5.0cm"); _xmlWriter.WriteEndElement(); // TableColumn _xmlWriter.WriteStartElement("TableColumn"); RdlRender.AddLine(_xmlWriter, "Width", "5.0cm"); _xmlWriter.WriteEndElement(); // TableColumn _xmlWriter.WriteEndElement(); // TableColumns _xmlWriter.WriteEndElement(); // Table // End of table of keys rendering _xmlWriter.WriteStartElement("Matrix"); _xmlWriter.WriteAttributeString("Name", "Matrix1"); RdlRender.AddLine(_xmlWriter, "DataSetName", _matrixDataSetName + "DataSet"); RdlRender.AddLine(_xmlWriter, "Top", "2.5cm"); RdlRender.AddLine(_xmlWriter, "Left", ".5in"); RdlRender.AddLine(_xmlWriter, "Height", ".5in"); RdlRender.AddLine(_xmlWriter, "Width", "6in"); _xmlWriter.WriteStartElement("Corner"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(_xmlWriter, "CornerTextbox", "", _cornerTextboxStyle, "", "", "", "", "true", "", "", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // Corner // Render MatrixRows _xmlWriter.WriteStartElement("MatrixRows"); foreach (MatrixRow CurrentRow in _matrixRowList) { CurrentRow.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); // MatrixRows _xmlWriter.WriteStartElement("MatrixColumns"); _xmlWriter.WriteStartElement("MatrixColumn"); RdlRender.AddLine(_xmlWriter, "Width", "3.25cm"); _xmlWriter.WriteEndElement(); // MatrixColumns _xmlWriter.WriteEndElement(); // MatrixColumn // Render ColumnGroupings _xmlWriter.WriteStartElement("ColumnGroupings"); foreach (MatrixDynamicColumnGrouping CurrentColGroup in _dynamicColumnGroupingList) { CurrentColGroup.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); // Render RowGroupings _xmlWriter.WriteStartElement("RowGroupings"); foreach (MatrixDynamicRowGrouping CurrentRowGroup in _dynamicRowGroupingList) { CurrentRowGroup.Render(_xmlWriter); } _xmlWriter.WriteStartElement("RowGrouping"); RdlRender.AddLine(_xmlWriter, "Width", "3.5cm"); _xmlWriter.WriteStartElement("StaticRows"); foreach (MatrixStaticRow CurrentRow in _matrixStaticRowList) { CurrentRow.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); // StaticRows _xmlWriter.WriteEndElement(); // RowGrouping _xmlWriter.WriteEndElement(); // RowGroupings RdlRender.AddLine(_xmlWriter, "NoRows", Resource.GetString("RES_REPORT_NOROWSRETURNED")); _xmlWriter.WriteEndElement(); // Matrix _xmlWriter.WriteEndElement(); // ReportItems RdlRender.AddLine(_xmlWriter, "ColumnSpacing", "1cm"); _xmlWriter.WriteEndElement(); // Body // DataSources _xmlWriter.WriteStartElement("DataSources"); _xmlWriter.WriteStartElement("DataSource"); _xmlWriter.WriteAttributeString("Name", "DataSource1"); // _xmlWriter.WriteStartElement("ConnectionProperties"); RdlRender.AddLine(_xmlWriter, "DataSourceReference", "/" + _dataSource); // RdlRender.AddLine(_xmlWriter, "DataProvider", "SQL"); // RdlRender.AddLine(_xmlWriter, "ConnectString", _dbConnectionString); // RdlRender.AddLine(_xmlWriter, "IntegratedSecurity", "false"); // RdlRender.AddLine(_xmlWriter, "Prompt", "false"); // _xmlWriter.WriteEndElement(); // ConnectionProperties _xmlWriter.WriteEndElement(); // DataSource _xmlWriter.WriteEndElement(); // DataSources // Datasets _xmlWriter.WriteStartElement("DataSets"); foreach (Dataset CurrentDataset in _datasetList) { CurrentDataset.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); // ReportParameters if (_reportParameterList != null && _reportParameterList.Count > 0) { _xmlWriter.WriteStartElement("ReportParameters"); foreach (ReportParameter CurrentParameter in _reportParameterList) { CurrentParameter.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); } // EmbeddedImages _xmlWriter.WriteStartElement("EmbeddedImages"); _xmlWriter.WriteStartElement("EmbeddedImage"); _xmlWriter.WriteAttributeString("Name", "Esf"); RdlRender.AddLine(_xmlWriter, "MIMEType", "image/bmp"); _xmlWriter.WriteStartElement("ImageData"); // Image data FileStream ImageStream = new FileStream(HttpContext.Current.Server.MapPath( ConfigurationManager.AppSettings["SmallSystemsLogoImage"]), FileMode.Open, FileAccess.Read); byte[] ImageByteArray = new Byte[ImageStream.Length]; ImageStream.Read(ImageByteArray, 0, (int)ImageStream.Length); ImageStream.Close(); _xmlWriter.WriteBase64(ImageByteArray, 0, ImageByteArray.Length); _xmlWriter.WriteEndElement(); // ImageData _xmlWriter.WriteEndElement(); // EmbeddedImage _xmlWriter.WriteEndElement(); // EmbeddedImages // Report footer _xmlWriter.WriteStartElement("PageFooter"); RdlRender.AddLine(_xmlWriter, "Height", "1.0cm"); RdlRender.AddLine(_xmlWriter, "PrintOnFirstPage", "true"); RdlRender.AddLine(_xmlWriter, "PrintOnLastPage", "true"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(_xmlWriter, "ReportDescriptionTextBox", _reportDescription, BoldBorderedTextBoxStyle, "", "0.25cm", "1.0cm", "16.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); //Report Filters foreach (ReportFilterBusinessObject _CurrentFilter in _filterItemList) { FilterCount++; _Filter = "Filter" + FilterCount.ToString(); _FilterDescription = "Data Filter Applied : " + _CurrentFilter.DataItemCaption + " " + _CurrentFilter.Operand + " " + _CurrentFilter.FilterValue; RdlRender.AddTextbox(_xmlWriter, _Filter, _FilterDescription, BoldBorderedTextBoxStyle, "", "0.25cm", "1.00cm", "16.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); } _xmlWriter.WriteEndElement(); // Report _xmlWriter.WriteEndDocument(); _xmlWriter.Flush(); _memoryStream.Close(); return(_memoryStream.GetBuffer()); //_stream.Close(); //return new byte[0]; }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes this object render itself as an RDL Report type to an XmlWriter instance. /// It calls upon all objects immediately beneath it (TableHeader, TableGroup, /// TableDetails, Datasets, ReportParameters) to render themselves also. /// </summary> /// <returns>A Byte array containing the raw RDL data.</returns> public Byte[] Render() { // Styles for the textboxes ReportingServicesStyle _textboxStyle14pt = new ReportingServicesStyle( ReportingServicesStyle.TextBoxStyle.TabularReport14pt); ReportingServicesStyle _textboxStyle10pt = new ReportingServicesStyle( ReportingServicesStyle.TextBoxStyle.TabularReport10pt); _xmlWriter.WriteStartDocument(); _xmlWriter.WriteStartElement("Report"); _xmlWriter.WriteAttributeString("xmlns", "http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"); RdlRender.AddLine(_xmlWriter, "Width", "1.0in"); RdlRender.AddLine(_xmlWriter, "PageWidth", "11.5in"); RdlRender.AddLine(_xmlWriter, "TopMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "BottomMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "LeftMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "RightMargin", "0.25in"); RdlRender.AddLine(_xmlWriter, "PageHeight", "7.9375in"); RdlRender.AddLine(_xmlWriter, "Language", "en-GB"); _xmlWriter.WriteStartElement("PageHeader"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(_xmlWriter, "TitleTextbox", "DWP Small Systems Ad Hoc Reporting System", _textboxStyle14pt, "Left", "0.3cm", "5.0cm", "10cm", "true", "0.95cm", "2", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox(_xmlWriter, "PageHeader", "=Globals!ReportName", _textboxStyle14pt, "Left", "2.85714cm", "1.26984cm", "14.92063cm", "true", "1cm", "", "", "", "", "", "", "", "", ""); RdlRender.AddImage(_xmlWriter, "Image1", "2.59259cm", "3.8cm", "1.0cm", "Embedded", "Esf", "AutoSize"); int ParameterCount = 0; int X = 0; string ParameterHeight = ""; foreach (String _parameterName in _parameterList) { ParameterCount++; X = ParameterCount; X = X + 3; ParameterHeight = X.ToString() + "cm"; RdlRender.AddTextbox(_xmlWriter, "Parameter" + ParameterCount.ToString(), _parameterName, _textboxStyle14pt, "Left", ParameterHeight, "1.26984cm", "14.92063cm", "true", "1cm", "", "", "", "", "", "", "", "", ""); } _xmlWriter.WriteEndElement(); // ReportItems X = ParameterCount; X = X + 4; ParameterHeight = X.ToString() + ".8cm"; RdlRender.AddLine(_xmlWriter, "PrintOnLastPage", "true"); RdlRender.AddLine(_xmlWriter, "PrintOnFirstPage", "true"); RdlRender.AddLine(_xmlWriter, "Height", ParameterHeight); _xmlWriter.WriteEndElement(); // PagHeader _xmlWriter.WriteStartElement("Body"); RdlRender.AddLine(_xmlWriter, "Height", "5in"); _xmlWriter.WriteStartElement("ReportItems"); _xmlWriter.WriteStartElement("Table"); _xmlWriter.WriteAttributeString("Name", "Table1"); RdlRender.AddLine(_xmlWriter, "DataSetName", "TableDataSet"); RdlRender.AddLine(_xmlWriter, "Top", "0in"); RdlRender.AddLine(_xmlWriter, "Left", ".5in"); RdlRender.AddLine(_xmlWriter, "Height", "0in"); RdlRender.AddLine(_xmlWriter, "Width", "6in"); // TableHeader _tableHeader.Render(_xmlWriter); // TableGroups if (_tableGroupList == null || _tableGroupList.Count > 0) { _xmlWriter.WriteStartElement("TableGroups"); foreach (TableGroup group in _tableGroupList) { group.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); // TableGroups } _xmlWriter.WriteStartElement("Style"); _xmlWriter.WriteEndElement(); // Write table columns _xmlWriter.WriteStartElement("TableColumns"); for (int i = 0; i < _selectedDataItems.Count; i++) { _xmlWriter.WriteStartElement("TableColumn"); RdlRender.AddLine(_xmlWriter, "Width", "1.5in"); _xmlWriter.WriteEndElement(); } _xmlWriter.WriteEndElement(); // TableColumns // TableDetails if (_isSummaryReport == false) { _tableDetails.Render(_xmlWriter); } RdlRender.AddLine(_xmlWriter, "NoRows", Resource.GetString("RES_REPORT_NOROWSRETURNED")); // TableFooter _tableFooter.Render(_xmlWriter); _xmlWriter.WriteEndElement(); // Table _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // Body // DataSources _xmlWriter.WriteStartElement("DataSources"); _xmlWriter.WriteStartElement("DataSource"); _xmlWriter.WriteAttributeString("Name", "DataSource1"); RdlRender.AddLine(_xmlWriter, "DataSourceReference", "/" + _dataSource); /*_xmlWriter.WriteStartElement("ConnectionProperties"); * RdlRender.AddLine( _xmlWriter, "DataProvider", "SQL"); * RdlRender.AddLine( _xmlWriter, "ConnectString", _dbConnectionString); * RdlRender.AddLine( _xmlWriter, "IntegratedSecurity", "false"); * RdlRender.AddLine( _xmlWriter, "Prompt", "false"); * _xmlWriter.WriteEndElement(); // ConnectionProperties */ _xmlWriter.WriteEndElement(); // DataSource _xmlWriter.WriteEndElement(); // DataSources // Datasets _xmlWriter.WriteStartElement("DataSets"); foreach (Dataset CurrentDataSet in _datasetList) { CurrentDataSet.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); // ReportParameters if (_reportParametersList != null && _reportParametersList.Count > 0) { _xmlWriter.WriteStartElement("ReportParameters"); foreach (ReportParameter CurrentParameter in _reportParametersList) { CurrentParameter.Render(_xmlWriter); } _xmlWriter.WriteEndElement(); } // EmbeddedImages _xmlWriter.WriteStartElement("EmbeddedImages"); _xmlWriter.WriteStartElement("EmbeddedImage"); _xmlWriter.WriteAttributeString("Name", "Esf"); RdlRender.AddLine(_xmlWriter, "MIMEType", "image/bmp"); _xmlWriter.WriteStartElement("ImageData"); // Image data FileStream ImageStream = new FileStream( ConfigurationManager.AppSettings["SmallSystemsLogoImage"], FileMode.Open, FileAccess.Read); byte[] ImageByteArray = new byte[ImageStream.Length]; ImageStream.Read(ImageByteArray, 0, (int)ImageStream.Length); ImageStream.Close(); _xmlWriter.WriteBase64(ImageByteArray, 0, ImageByteArray.Length); _xmlWriter.WriteEndElement(); // ImageData _xmlWriter.WriteEndElement(); // EmbeddedImage _xmlWriter.WriteEndElement(); // EmbeddedImages // Report footer _xmlWriter.WriteStartElement("PageFooter"); RdlRender.AddLine(_xmlWriter, "Height", "1.0cm"); RdlRender.AddLine(_xmlWriter, "PrintOnFirstPage", "true"); RdlRender.AddLine(_xmlWriter, "PrintOnLastPage", "true"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox(_xmlWriter, "UserTextBox", "=User!UserID", _textboxStyle10pt, "", "0.25cm", "1.0cm", "6.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox(_xmlWriter, "ExecutionTimeTextBox", "=Globals!ExecutionTime", _textboxStyle10pt, "", "0.25cm", "7.00cm", "6.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox(_xmlWriter, "PageNumberTextBox", "=Globals!PageNumber", _textboxStyle10pt, "", "0.25cm", "15.00cm", "3.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // PageFooter _xmlWriter.WriteEndElement(); // Report _xmlWriter.WriteEndDocument(); _xmlWriter.Flush(); _memoryStream.Close(); return(_memoryStream.GetBuffer()); //_stream.Close(); // return new byte[0]; }