//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL Details type to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("Details"); xmlWriter.WriteStartElement("TableRows"); xmlWriter.WriteStartElement("TableRow"); xmlWriter.WriteStartElement("TableCells"); foreach (TableDetailsTextBox Textbox in _tableDetailsTextBoxList) { Textbox.Render(xmlWriter); } xmlWriter.WriteEndElement(); // TableCells // Render footer RDL. Add Visibility information if drillDownGroup != "" RdlRender.AddLine(xmlWriter, "Height", ".25in"); if (_drillDownGroup != "") { xmlWriter.WriteStartElement("Visibility"); RdlRender.AddLine(xmlWriter, "Hidden", "true"); RdlRender.AddLine(xmlWriter, "ToggleItem", "Group" + _drillDownGroup); xmlWriter.WriteEndElement(); // Visibility } xmlWriter.WriteEndElement(); // TableRow xmlWriter.WriteEndElement(); // TableRows xmlWriter.WriteEndElement(); // Details }
/// <summary> /// Renders this style in RDL using the supplied XmlWriter. /// </summary> /// <param name="xmlWriter">The XmlWriter used to write the RDL.</param> public void Render2010TextRun(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("Style"); //xmlWriter.WriteStartElement("BorderStyle"); //RdlRender.AddLine(xmlWriter, "Top", _borderStyle); //RdlRender.AddLine(xmlWriter, "Bottom", _borderStyle); //RdlRender.AddLine(xmlWriter, "Left", _borderStyle); //RdlRender.AddLine(xmlWriter, "Right", _borderStyle); //xmlWriter.WriteEndElement(); // BorderStyle //xmlWriter.WriteStartElement("BorderColor"); //RdlRender.AddLine(xmlWriter, "Top", _borderColour); //RdlRender.AddLine(xmlWriter, "Bottom", _borderColour); //RdlRender.AddLine(xmlWriter, "Left", _borderColour); //RdlRender.AddLine(xmlWriter, "Right", _borderColour); //xmlWriter.WriteEndElement(); // BorderColour //RdlRender.AddLine(xmlWriter, "BackgroundColor", _backgroundColour); //RdlRender.AddLine(xmlWriter, "PaddingLeft", _paddingLeft); //RdlRender.AddLine(xmlWriter, "PaddingRight", _paddingRight); //RdlRender.AddLine(xmlWriter, "PaddingTop", _paddingTop); //RdlRender.AddLine(xmlWriter, "PaddingBottom", _paddingBottom); RdlRender.AddLine(xmlWriter, "FontSize", _fontSize); RdlRender.AddLine(xmlWriter, "FontWeight", _fontWeight); //21/07/05 LL - TIR0200 Set Text Alignment //RdlRender.AddLine(xmlWriter, "TextAlign", _textAlign); //RdlRender.AddLine(xmlWriter, "VerticalAlign", _verticalAlign); RdlRender.AddLine(xmlWriter, "Color", _color); RdlRender.AddLine(xmlWriter, "TextDecoration", _textDecoration); RdlRender.AddLine(xmlWriter, "Format", _format); // end Style tag xmlWriter.WriteEndElement();//Style }
public void Render2010TextBox(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("Style"); xmlWriter.WriteStartElement("TopBorder"); RdlRender.AddLine(xmlWriter, "Color", _borderColour); RdlRender.AddLine(xmlWriter, "Style", _borderStyle); xmlWriter.WriteEndElement(); // TopBorder xmlWriter.WriteStartElement("BottomBorder"); RdlRender.AddLine(xmlWriter, "Color", _borderColour); RdlRender.AddLine(xmlWriter, "Style", _borderStyle); xmlWriter.WriteEndElement(); // BottomBorder xmlWriter.WriteStartElement("LeftBorder"); RdlRender.AddLine(xmlWriter, "Color", _borderColour); RdlRender.AddLine(xmlWriter, "Style", _borderStyle); xmlWriter.WriteEndElement(); // LeftBorder xmlWriter.WriteStartElement("RightBorder"); RdlRender.AddLine(xmlWriter, "Color", _borderColour); RdlRender.AddLine(xmlWriter, "Style", _borderStyle); xmlWriter.WriteEndElement(); // RightBorder RdlRender.AddLine(xmlWriter, "BackgroundColor", _backgroundColour); RdlRender.AddLine(xmlWriter, "PaddingLeft", _paddingLeft); RdlRender.AddLine(xmlWriter, "PaddingRight", _paddingRight); RdlRender.AddLine(xmlWriter, "PaddingTop", _paddingTop); RdlRender.AddLine(xmlWriter, "PaddingBottom", _paddingBottom); //????? RdlRender.AddLine(xmlWriter, "TextAlign", _textAlign); RdlRender.AddLine(xmlWriter, "VerticalAlign", _verticalAlign); RdlRender.AddLine(xmlWriter, "Format", _format); // end Style tag xmlWriter.WriteEndElement();//Style }
//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. /// <summary> /// Makes object render itself as an RDL Query 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: Add necessary comment on each code block and //indent the code as in XML where possible to increase readability // Done 24/05/2005 xmlWriter.WriteStartElement("Query"); RdlRender.AddLine(xmlWriter, "DataSourceName", "DataSource1"); RdlRender.AddLine(xmlWriter, "CommandType", "Text"); xmlWriter.WriteStartElement("CommandText"); //Puts the current user code into the SQL context info. The SetContextInfo stored procedure must exist on the database. xmlWriter.WriteString("EXECUTE [SetContextInfo] @ReportUserCode "); xmlWriter.WriteString(_queryText); xmlWriter.WriteEndElement(); //CommandText RdlRender.AddLine(xmlWriter, "Timeout", "120"); // Each queryParameter must render itself if (_queryParameters == null || _queryParameters.Count > 0) { xmlWriter.WriteStartElement("QueryParameters"); foreach (string Item in _queryParameters) { xmlWriter.WriteStartElement("QueryParameter"); xmlWriter.WriteAttributeString("Name", "@" + Item); RdlRender.AddLine(xmlWriter, "Value", "=Parameters!" + Item + ".Value"); xmlWriter.WriteEndElement(); // QueryParameter } xmlWriter.WriteEndElement(); // QueryParameters } xmlWriter.WriteEndElement(); // Query }
//TODO: Code Review Issue 11/05/05: Give a more specific summary rather than //using 'object' word. // Done 24/05/2005 /// <summary> /// Makes this field render itself as an RDL Field to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("Field"); xmlWriter.WriteAttributeString("Name", _name); RdlRender.AddLine(xmlWriter, "DataField", _caption); xmlWriter.WriteEndElement(); }
/// <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 Render2010(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); //RdlRender.AddLine(xmlWriter, "RepeatOnNewPage", "true"); //Report Description xmlWriter.WriteStartElement("TablixRow"); RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteStartElement("TablixCells"); xmlWriter.WriteStartElement("TablixCell"); xmlWriter.WriteStartElement("CellContents"); xmlWriter.WriteStartElement("ColSpan"); xmlWriter.WriteString(_colSpan); xmlWriter.WriteEndElement();//ColSpan RdlRender.AddTextbox2010(xmlWriter, "reportDescription", _reportDescription, _textboxStyle10pt, "", "0.25cm", "15.00cm", "3.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); //CellContents xmlWriter.WriteEndElement(); //TablixCell for (int x = 0; x < (int.Parse(_colSpan) - 1); x++) { xmlWriter.WriteStartElement("TablixCell"); xmlWriter.WriteEndElement(); //TablixCell } xmlWriter.WriteEndElement(); //TablixCells xmlWriter.WriteEndElement(); //TablixRow //Report Filters foreach (ReportFilterBusinessObject _CurrentFilter in _filterItemList) { FilterCount++; _Filter = "Filter" + FilterCount.ToString(); xmlWriter.WriteStartElement("TablixRow"); RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteStartElement("TablixCells"); xmlWriter.WriteStartElement("TablixCell"); xmlWriter.WriteStartElement("CellContents"); xmlWriter.WriteStartElement("ColSpan"); xmlWriter.WriteString(_colSpan); xmlWriter.WriteEndElement();//ColSpan _FilterDescription = "Data Filter Applied : " + _CurrentFilter.DataItemCaption + " " + _CurrentFilter.Operand + " " + _CurrentFilter.FilterValue; RdlRender.AddTextbox2010(xmlWriter, _Filter, _FilterDescription, _textboxStyle10pt, "", "0.25cm", "15.00cm", "3.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); xmlWriter.WriteEndElement(); //CellContents xmlWriter.WriteEndElement(); //TablixCell for (int x = 0; x < (int.Parse(_colSpan) - 1); x++) { xmlWriter.WriteStartElement("TablixCell"); xmlWriter.WriteEndElement(); //TablixCell } xmlWriter.WriteEndElement(); //TablixCells xmlWriter.WriteEndElement(); //TablixRow } }
public void RenderAxes2010(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("ChartAxis"); xmlWriter.WriteAttributeString("Name", _seriesName); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "Format", "#,0;(#,0)"); RdlRender.AddLine(xmlWriter, "FontSize", "8pt"); xmlWriter.WriteEndElement();//Style xmlWriter.WriteStartElement("ChartAxisTitle"); RdlRender.AddLine(xmlWriter, "Caption", "Units"); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "FontSize", "8pt"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartAxisTitle //RdlRender.AddLine(xmlWriter,"Interval","1"); RdlRender.AddLine(xmlWriter, "IntervalType", "Default"); //xmlWriter.WriteStartElement("ChartMajorGridLines"); //RdlRender.AddLine(xmlWriter,"Enabled","False"); //xmlWriter.WriteStartElement("Style"); //xmlWriter.WriteStartElement("Border"); //RdlRender.AddLine(xmlWriter,"Color","Gainsboro"); //xmlWriter.WriteEndElement();//Border //xmlWriter.WriteEndElement();//Style //xmlWriter.WriteEndElement();//ChartMajorGridLines xmlWriter.WriteStartElement("ChartMinorGridLines"); RdlRender.AddLine(xmlWriter, "Enabled", "False"); xmlWriter.WriteStartElement("Style"); xmlWriter.WriteStartElement("Border"); RdlRender.AddLine(xmlWriter, "Color", "Gainsboro"); RdlRender.AddLine(xmlWriter, "Style", "Dotted"); xmlWriter.WriteEndElement(); //Border xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartMinorGridLines //xmlWriter.WriteStartElement("ChartMajorTickMarks"); //RdlRender.AddLine(xmlWriter,"IntervalType","Auto"); //xmlWriter.WriteEndElement();//ChartMajorTickMarks xmlWriter.WriteStartElement("ChartMinorTickMarks"); RdlRender.AddLine(xmlWriter, "Length", "0.5"); RdlRender.AddLine(xmlWriter, "IntervalType", "Auto"); xmlWriter.WriteEndElement();//ChartMinorTickMarks RdlRender.AddLine(xmlWriter, "CrossAt", "NaN"); RdlRender.AddLine(xmlWriter, "Interlaced", "true"); RdlRender.AddLine(xmlWriter, "Minimum", "NaN"); RdlRender.AddLine(xmlWriter, "Maximum", "NaN"); xmlWriter.WriteStartElement("ChartAxisScaleBreak"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteEndElement(); //ChartAxisScaleBreak xmlWriter.WriteEndElement(); //ChartAxis }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL ReportParameter to an XmlWriter object. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("ReportParameter"); xmlWriter.WriteAttributeString("Name", _name); // Render relevant data type switch (_type) { case "char": case "varchar": case "nchar": case "nvarchar": RdlRender.AddLine(xmlWriter, "DataType", "String"); break; case "datetime": case "date": case "time": case "timestamp": RdlRender.AddLine(xmlWriter, "DataType", "DateTime"); break; case "money": case "decimal": case "numeric": RdlRender.AddLine(xmlWriter, "DataType", "Float"); break; case "int": RdlRender.AddLine(xmlWriter, "DataType", "Integer"); break; default: //TODO: Code Review Issue 11/05/05: Replace the hard-coded message by a Resource Helper Text // Done 24/05/2005 throw new Exception(Resource.GetString("RES_EXCEPTION_REPORTPARAMETER_INVALIDDATATYPE")); } // ValidValues: This displays parameters with values in a drop-down list // if the item is not a value type if (!_isValueType) { xmlWriter.WriteStartElement("ValidValues"); xmlWriter.WriteStartElement("DataSetReference"); RdlRender.AddLine(xmlWriter, "DataSetName", _name + "ParameterDataSet"); RdlRender.AddLine(xmlWriter, "ValueField", _name); xmlWriter.WriteEndElement(); // DataSetReference xmlWriter.WriteEndElement(); // ValidValues } RdlRender.AddLine(xmlWriter, "Prompt", _caption); RdlRender.AddLine(xmlWriter, "AllowBlank", "true"); RdlRender.AddLine(xmlWriter, "Nullable", "true"); xmlWriter.WriteEndElement(); // ReportParameter }
public void Render2010(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("ChartSeries"); xmlWriter.WriteAttributeString("Name", SeriesDataItem.Name); xmlWriter.WriteStartElement("ChartDataPoints"); xmlWriter.WriteStartElement("ChartDataPoint"); xmlWriter.WriteStartElement("ChartDataPointValues"); RdlRender.AddLine(xmlWriter, "X", "=Fields!" + _categoryName + ".Value"); RdlRender.AddLine(xmlWriter, "Y", "=Sum(Fields!" + _seriesName + ".Value)"); xmlWriter.WriteEndElement();//ChartDataPointValues xmlWriter.WriteStartElement("ChartDataLabel"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteEndElement();//ChartDataLabel RdlRender.AddLine(xmlWriter, "ToolTip", "=FormatNumber(Sum(Fields!" + _seriesName + ".Value),0,true,false,true)"); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); xmlWriter.WriteEndElement();//Style xmlWriter.WriteStartElement("ChartMarker"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteEndElement(); //ChartMarker RdlRender.AddLine(xmlWriter, "DataElementOutput", "Output"); xmlWriter.WriteEndElement(); //ChartDataPoint xmlWriter.WriteEndElement(); //ChartDataPoints xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "ShadowOffset", "0pt"); xmlWriter.WriteEndElement();//Style xmlWriter.WriteStartElement("ChartEmptyPoints"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteStartElement("ChartMarker"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteEndElement();//ChartMarker xmlWriter.WriteStartElement("ChartDataLabel"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteEndElement(); //ChartDataLabel xmlWriter.WriteEndElement(); //ChartEmptyPoints RdlRender.AddLine(xmlWriter, "ValueAxisName", _seriesName); RdlRender.AddLine(xmlWriter, "CategoryAxisName", _categoryName); xmlWriter.WriteStartElement("ChartSmartLabel"); RdlRender.AddLine(xmlWriter, "CalloutLineColor", "Black"); RdlRender.AddLine(xmlWriter, "MinMovingDistance", "0pt"); xmlWriter.WriteEndElement(); //ChartSmartLabel xmlWriter.WriteEndElement(); //ChartSeries }
/// <summary> /// Makes object render itself as an RDL Details type to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render2010(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("TablixRow"); RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteStartElement("TablixCells"); foreach (TableDetailsTextBox Textbox in _tableDetailsTextBoxList) { Textbox.Render2010(xmlWriter); } xmlWriter.WriteEndElement(); // TablixCells xmlWriter.WriteEndElement(); // TablixRow }
/// <summary> /// Makes object render itself as an RDL Header type to an XmlWriter instance. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render2010(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("TablixRow"); RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteStartElement("TablixCells"); foreach (ITableHeaderTextBox TextBox in _tableHeaderTextBoxList) { TextBox.Render2010(xmlWriter); } xmlWriter.WriteEndElement(); //TablixCells xmlWriter.WriteEndElement(); //TablixRow // RdlRender.AddLine(xmlWriter, "RepeatOnNewPage", "true"); }
//TODO: Code Review Issue 11/05/05: Give a more detailed summary. // Done 24/05/2005 /// <summary> /// Makes object render itself as an RDL Header 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 xmlWriter.WriteStartElement("Header"); RdlRender.AddLine(xmlWriter, "RepeatOnNewPage", "true"); xmlWriter.WriteStartElement("TableRows"); xmlWriter.WriteStartElement("TableRow"); xmlWriter.WriteStartElement("TableCells"); foreach (TableHeaderTextBox TextBox in _tableHeaderTextBoxList) { TextBox.Render(xmlWriter); } xmlWriter.WriteEndElement(); RdlRender.AddLine(xmlWriter, "Height", ".25in"); xmlWriter.WriteEndElement(); 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 a RowGrouping in RDL to an XmlWriter. /// </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("RowGrouping"); RdlRender.AddLine(xmlWriter, "Width", "3.5cm"); xmlWriter.WriteStartElement("DynamicRows"); xmlWriter.WriteStartElement("Grouping"); xmlWriter.WriteAttributeString("Name", _name + "RowGrouping"); xmlWriter.WriteStartElement("GroupExpressions"); RdlRender.AddLine(xmlWriter, "GroupExpression", "=Fields!" + _name + ".Value"); xmlWriter.WriteEndElement(); // GroupExpressions xmlWriter.WriteEndElement(); // Grouping xmlWriter.WriteStartElement("Sorting"); xmlWriter.WriteStartElement("SortBy"); RdlRender.AddLine(xmlWriter, "SortExpression", "=Fields!" + _name + ".Value"); RdlRender.AddLine(xmlWriter, "Direction", "Ascending"); xmlWriter.WriteEndElement(); // SortBy xmlWriter.WriteEndElement(); // Sorting if (_drillDownGroup != "") { xmlWriter.WriteStartElement("Visibility"); RdlRender.AddLine(xmlWriter, "ToggleItem", _drillDownGroup); RdlRender.AddLine(xmlWriter, "Hidden", "true"); xmlWriter.WriteEndElement(); } _matrixDynamicRowTextBox.Render(xmlWriter); if (_isSubTotal) { _matrixDynamicRowSubTotal.Render(xmlWriter); } xmlWriter.WriteEndElement(); // DynamicRows xmlWriter.WriteEndElement(); // RowGrouping }
/// <summary> /// Makes object render itself in RDL to an XmlWriter object. /// </summary> /// <param name="xmlWriter">The XMLWriter to be rendered to.</param> public void Render(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("DataSet"); xmlWriter.WriteAttributeString("Name", _name + "DataSet"); xmlWriter.WriteStartElement("Fields"); //TODO: Code Review Issue : 10/05/2005 - Casing for method variable. //Also should use {} for loop statement for clarity foreach (Field f in _fieldList) { f.Render(xmlWriter); } xmlWriter.WriteStartElement("Field"); xmlWriter.WriteAttributeString("Name", "GroupingLevel"); RdlRender.AddLine(xmlWriter, "DataField", "GroupingLevel"); xmlWriter.WriteEndElement(); // Field xmlWriter.WriteEndElement(); // Fields _queryWrapper.Render(xmlWriter); xmlWriter.WriteEndElement(); // DataSet }
/// <summary> /// Stub. /// </summary> /// <returns></returns> public void Render(XmlWriter xmlWriter) { if (!_wrapperRequired) { _query.Render(xmlWriter); } else { xmlWriter.WriteStartElement("Query"); RdlRender.AddLine(xmlWriter, "DataSourceName", "DataSource1"); RdlRender.AddLine(xmlWriter, "CommandType", "Text"); xmlWriter.WriteStartElement("CommandText"); xmlWriter.WriteString(GetQueryText()); xmlWriter.WriteEndElement(); //CommandText RdlRender.AddLine(xmlWriter, "Timeout", "120"); // Each queryParameter must render itself if (_parameterList == null || _parameterList.Count > 0 || _queryParameterList.Count > 0) { xmlWriter.WriteStartElement("QueryParameters"); foreach (string Item in _queryParameterList) { xmlWriter.WriteStartElement("QueryParameter"); xmlWriter.WriteAttributeString("Name", "@" + Item); RdlRender.AddLine(xmlWriter, "Value", "=Parameters!" + Item + ".Value"); xmlWriter.WriteEndElement(); // QueryParameter } xmlWriter.WriteEndElement(); // QueryParameters } xmlWriter.WriteEndElement(); // Query } }
/// <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[] Render2010() { // 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/2010/01/reportdefinition"); _xmlWriter.WriteAttributeString("xmlns:cl", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"); RdlRender.AddLine(_xmlWriter, "AutoRefresh", "0"); // 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.Render2010(_xmlWriter); } _xmlWriter.WriteEndElement(); //DataSets //ReportSections _xmlWriter.WriteStartElement("ReportSections"); //ReportSection _xmlWriter.WriteStartElement("ReportSection"); _xmlWriter.WriteStartElement("Body"); RdlRender.AddLine(_xmlWriter, "Height", "5in"); _xmlWriter.WriteStartElement("ReportItems"); _xmlWriter.WriteStartElement("Tablix"); _xmlWriter.WriteAttributeString("Name", "Table1"); RdlRender.AddLine(_xmlWriter, "DataSetName", "TableDataSet"); RdlRender.AddLine(_xmlWriter, "NoRowsMessage", Resource.GetString("RES_REPORT_NOROWSRETURNED")); RdlRender.AddLine(_xmlWriter, "Top", "0in"); RdlRender.AddLine(_xmlWriter, "Left", ".5in"); RdlRender.AddLine(_xmlWriter, "Height", "0in"); RdlRender.AddLine(_xmlWriter, "Width", "6in"); _xmlWriter.WriteStartElement("TablixBody"); // Write table columns _xmlWriter.WriteStartElement("TablixColumns"); for (int i = 0; i < _fieldDataItems.Count; i++) { _xmlWriter.WriteStartElement("TablixColumn"); RdlRender.AddLine(_xmlWriter, "Width", "1.5in"); _xmlWriter.WriteEndElement(); // TablixColumn } _xmlWriter.WriteEndElement(); // TablixColumns // Write table rows _xmlWriter.WriteStartElement("TablixRows"); // TableHeader _tableHeader.Render2010(_xmlWriter); // TableGroups if (_tableGroupList != null && _tableGroupList.Count > 0) { foreach (TableGroup group in _tableGroupList) { group.Render2010(_xmlWriter); } } // TableDetails if (_isSummaryReport == false) { _tableDetails.Render2010(_xmlWriter); } // TableFooter _tableFooter.Render2010(_xmlWriter); _xmlWriter.WriteEndElement(); // TablixRows _xmlWriter.WriteEndElement(); // TablixBody _xmlWriter.WriteStartElement("TablixColumnHierarchy"); _xmlWriter.WriteStartElement("TablixMembers"); for (int i = 0; i < _fieldDataItems.Count; i++) { _xmlWriter.WriteStartElement("TablixMember"); _xmlWriter.WriteEndElement(); // TablixMember } _xmlWriter.WriteEndElement(); // TablixMembers _xmlWriter.WriteEndElement(); // TablixColumnHierarchy _xmlWriter.WriteStartElement("TablixRowHierarchy"); _xmlWriter.WriteStartElement("TablixMembers"); //Add Header row member _xmlWriter.WriteStartElement("TablixMember"); RdlRender.AddLine(_xmlWriter, "KeepWithGroup", "After"); RdlRender.AddLine(_xmlWriter, "FixedData", "true"); RdlRender.AddLine(_xmlWriter, "RepeatOnNewPage", "true"); RdlRender.AddLine(_xmlWriter, "KeepTogether", "true"); _xmlWriter.WriteEndElement(); // TablixMember //Add Group and details hierarchy members if (_tableGroupList != null && _tableGroupList.Count > 0) { for (int i = 0; i < _tableGroupList.Count; i++)// { _xmlWriter.WriteStartElement("TablixMember"); _xmlWriter.WriteStartElement("Group"); _xmlWriter.WriteAttributeString("Name", "Grouping" + _tableGroupList[i].Name); if (_tableGroupList[i].IsDataMapDisplayedGroup) // check if data map neds displaying { RdlRender.AddLine(_xmlWriter, "DocumentMapLabel", "=Fields!" + _tableGroupList[i].Name + ".Value"); } if (_isPageOnFirstItem && i == 0) { _xmlWriter.WriteStartElement("PageBreak"); RdlRender.AddLine(_xmlWriter, "BreakLocation", "Between"); _xmlWriter.WriteEndElement(); // PageBreak } _xmlWriter.WriteStartElement("GroupExpressions"); RdlRender.AddLine(_xmlWriter, "GroupExpression", "=Fields!" + _tableGroupList[i].Name + ".Value"); _xmlWriter.WriteEndElement(); // GroupExpressions _xmlWriter.WriteEndElement(); // Group _xmlWriter.WriteStartElement("SortExpressions"); _xmlWriter.WriteStartElement("SortExpression"); RdlRender.AddLine(_xmlWriter, "Value", "=Fields!" + _tableGroupList[i].Name + ".Value"); //RdlRender.AddLine(xmlWriter, "Direction", "Ascending"); _xmlWriter.WriteEndElement(); // SortExpression _xmlWriter.WriteEndElement(); // SortExpressions _xmlWriter.WriteStartElement("TablixMembers"); _xmlWriter.WriteStartElement("TablixMember"); if (i > 0 && _isDrillDown) { _xmlWriter.WriteStartElement("Visibility"); RdlRender.AddLine(_xmlWriter, "Hidden", "true"); RdlRender.AddLine(_xmlWriter, "ToggleItem", "Group" + _tableGroupList[i - 1].Name); _xmlWriter.WriteEndElement(); // Visibility } RdlRender.AddLine(_xmlWriter, "KeepWithGroup", "After"); RdlRender.AddLine(_xmlWriter, "KeepTogether", "true"); _xmlWriter.WriteEndElement(); // TablixMember } } // TableDetails if (_isSummaryReport == false) { _xmlWriter.WriteStartElement("TablixMember"); _xmlWriter.WriteStartElement("Group"); _xmlWriter.WriteAttributeString("Name", "Table1_Details_Group"); //if (_isDataMapDisplayedGroup == true) // check if data map neds displaying //{ // RdlRender.AddLine(xmlWriter, "Label", "=Fields!" + _name + ".Value"); //} RdlRender.AddLine(_xmlWriter, "DataElementName", "Detail"); _xmlWriter.WriteEndElement(); // Group _xmlWriter.WriteStartElement("TablixMembers"); _xmlWriter.WriteStartElement("TablixMember"); if (_isDrillDown) { _xmlWriter.WriteStartElement("Visibility"); RdlRender.AddLine(_xmlWriter, "Hidden", "true"); RdlRender.AddLine(_xmlWriter, "ToggleItem", "Group" + _tableGroupList[_tableGroupList.Count - 1].Name); _xmlWriter.WriteEndElement(); // Visibility } _xmlWriter.WriteEndElement(); // TablixMember _xmlWriter.WriteEndElement(); // TablixMembers RdlRender.AddLine(_xmlWriter, "DataElementName", "Detail_Collection"); RdlRender.AddLine(_xmlWriter, "DataElementOutput", "Output"); RdlRender.AddLine(_xmlWriter, "KeepTogether", "true"); _xmlWriter.WriteEndElement(); // TablixMember } //Close down the group hierarchies if (_tableGroupList != null && _tableGroupList.Count > 0) { for (int i = 0; i < _tableGroupList.Count; i++) // { _xmlWriter.WriteEndElement(); // TablixMembers _xmlWriter.WriteEndElement(); // TablixMember } } //Add Footer report name member _xmlWriter.WriteStartElement("TablixMember"); RdlRender.AddLine(_xmlWriter, "KeepWithGroup", "Before"); RdlRender.AddLine(_xmlWriter, "RepeatOnNewPage", "true"); RdlRender.AddLine(_xmlWriter, "KeepTogether", "true"); _xmlWriter.WriteEndElement(); // TablixMember //Add Footer filter selections for (int i = 0; i < _noOfFilters; i++) { _xmlWriter.WriteStartElement("TablixMember"); RdlRender.AddLine(_xmlWriter, "KeepWithGroup", "Before"); RdlRender.AddLine(_xmlWriter, "RepeatOnNewPage", "true"); RdlRender.AddLine(_xmlWriter, "KeepTogether", "true"); _xmlWriter.WriteEndElement(); // TablixMember } _xmlWriter.WriteEndElement(); // TablixMembers _xmlWriter.WriteEndElement(); // TablixRowHierarchy _xmlWriter.WriteStartElement("Style"); _xmlWriter.WriteEndElement(); _xmlWriter.WriteEndElement(); // Tablix foreach (Chart currentChart in _chartList) { currentChart.Render2010(_xmlWriter); } _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // Body RdlRender.AddLine(_xmlWriter, "Width", (_selectedDataItems.Count * 1.5 < 11.5)?"11.5in":(_selectedDataItems.Count * 1.5).ToString() + "in"); _xmlWriter.WriteStartElement("Page"); _xmlWriter.WriteStartElement("PageHeader"); _xmlWriter.WriteStartElement("ReportItems"); RdlRender.AddTextbox2010(_xmlWriter, "TitleTextbox", "DWP Small Systems Ad Hoc Reporting System", _textboxStyle14pt, "Left", "0.3cm", "2in", "6in", "true", "0.95cm", "2", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox2010(_xmlWriter, "PageHeader", "=Globals!ReportName", _textboxStyle14pt, "Left", "2.85714cm", "0.5in", "6in", "true", "1cm", "", "", "", "", "", "", "", "", ""); RdlRender.AddImage2010(_xmlWriter, "Image1", "2.59259cm", "1.5in", "0.5in", "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.AddTextbox2010(_xmlWriter, "Parameter" + ParameterCount.ToString(), _parameterName, _textboxStyle14pt, "Left", ParameterHeight, "0.5in", "6in", "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 // 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.AddTextbox2010(_xmlWriter, "UserTextBox", "=Parameters!ReportUserName.Value", _textboxStyle10pt, "", "0.25cm", "1.0cm", "6.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox2010(_xmlWriter, "ExecutionTimeTextBox", "=Globals!ExecutionTime", _textboxStyle10pt, "", "0.25cm", "7.00cm", "6.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); RdlRender.AddTextbox2010(_xmlWriter, "PageNumberTextBox", "=Globals!PageNumber", _textboxStyle10pt, "", "0.25cm", "15.00cm", "3.00cm", "true", "0.5cm", "1", "", "", "", "", "", "", "", ""); _xmlWriter.WriteEndElement(); // ReportItems _xmlWriter.WriteEndElement(); // PageFooter _xmlWriter.WriteEndElement(); // Page _xmlWriter.WriteEndElement(); // RepoetSection _xmlWriter.WriteEndElement(); // ReportSections //Add a report parameter for user id _xmlWriter.WriteStartElement("ReportParameters"); _xmlWriter.WriteStartElement("ReportParameter"); _xmlWriter.WriteAttributeString("Name", "ReportUserName"); // Render relevant data type RdlRender.AddLine(_xmlWriter, "DataType", "String"); RdlRender.AddLine(_xmlWriter, "Prompt", "User Name"); RdlRender.AddLine(_xmlWriter, "Hidden", "true"); _xmlWriter.WriteEndElement(); // ReportParameter _xmlWriter.WriteStartElement("ReportParameter"); _xmlWriter.WriteAttributeString("Name", "ReportUserCode"); // Render relevant data type RdlRender.AddLine(_xmlWriter, "DataType", "String"); RdlRender.AddLine(_xmlWriter, "Prompt", "User Name"); RdlRender.AddLine(_xmlWriter, "Hidden", "true"); _xmlWriter.WriteEndElement(); // ReportParameter // ReportParameters if (_reportParametersList != null && _reportParametersList.Count > 0) { foreach (ReportParameter CurrentParameter in _reportParametersList) { CurrentParameter.Render2010(_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 RdlRender.AddLine(_xmlWriter, "ConsumeContainerWhitespace", "true"); _xmlWriter.WriteEndElement(); // Report _xmlWriter.WriteEndDocument(); //****TESTING************* // _xmlWriter.Flush(); // XmlDocument doc = RdlRender.CreateXmlDocument(_memoryStream); //*****************/ _xmlWriter.Flush(); _memoryStream.Close(); return(_memoryStream.ToArray());// GetBuffer(); //_stream.Close(); // return new byte[0]; }
public void Render2010(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("Chart"); xmlWriter.WriteAttributeString("Name", "Chart" + _sortOrder.ToString()); xmlWriter.WriteStartElement("ChartCategoryHierarchy"); xmlWriter.WriteStartElement("ChartMembers"); xmlWriter.WriteStartElement("ChartMember"); xmlWriter.WriteStartElement("Group"); xmlWriter.WriteAttributeString("Name", "Chart" + _sortOrder.ToString() + "_CategoryGroup"); xmlWriter.WriteStartElement("GroupExpressions"); string categoryTableName = CurrentDataModel.DataTables.Single(x => x.Code == _categoryDataItem.DataTableCode).Name; // DataAccessUtilities.RepositoryLocator<IDataTableRepository>().GetByCode(_categoryDataItem.DataTableCode).Name; RdlRender.AddLine(xmlWriter, "GroupExpression", "=Fields!" + _categoryName + ".Value"); xmlWriter.WriteEndElement(); //GroupExpressions xmlWriter.WriteEndElement(); //Group xmlWriter.WriteStartElement("SortExpressions"); xmlWriter.WriteStartElement("SortExpression"); RdlRender.AddLine(xmlWriter, "Value", "=Fields!" + categoryTableName + _categoryDataItem.Name + ".Value"); xmlWriter.WriteEndElement(); //SortExpression xmlWriter.WriteEndElement(); //SortExpressions RdlRender.AddLine(xmlWriter, "Label", "=Fields!" + categoryTableName + _categoryDataItem.Name + ".Value"); xmlWriter.WriteEndElement(); //ChartMember xmlWriter.WriteEndElement(); //ChartMembers xmlWriter.WriteEndElement(); //ChartCategoryHierarchy xmlWriter.WriteStartElement("ChartSeriesHierarchy"); xmlWriter.WriteStartElement("ChartMembers"); foreach (ChartSeries seriesItem in _seriesItems) { xmlWriter.WriteStartElement("ChartMember"); RdlRender.AddLine(xmlWriter, "Label", seriesItem.SeriesDataItem.Caption); xmlWriter.WriteEndElement();//ChartMember } xmlWriter.WriteEndElement(); //ChartMembers xmlWriter.WriteEndElement(); //ChartSeriesHierarchy xmlWriter.WriteStartElement("ChartData"); xmlWriter.WriteStartElement("ChartSeriesCollection"); foreach (ChartSeries seriesItem in _seriesItems) { seriesItem.Render2010(xmlWriter); } xmlWriter.WriteEndElement(); //ChartSeriesCollection xmlWriter.WriteEndElement(); //ChartData xmlWriter.WriteStartElement("ChartAreas"); xmlWriter.WriteStartElement("ChartArea"); xmlWriter.WriteAttributeString("Name", "Default"); xmlWriter.WriteStartElement("ChartCategoryAxes"); xmlWriter.WriteStartElement("ChartAxis"); xmlWriter.WriteAttributeString("Name", _categoryName); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "FontSize", "8pt"); xmlWriter.WriteEndElement();//Style xmlWriter.WriteStartElement("ChartAxisTitle"); RdlRender.AddLine(xmlWriter, "Caption", _categoryDataItem.Caption); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "FontSize", "8pt"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartAxisTitle RdlRender.AddLine(xmlWriter, "Interval", "1"); RdlRender.AddLine(xmlWriter, "IntervalType", "Default"); xmlWriter.WriteStartElement("ChartMajorGridLines"); RdlRender.AddLine(xmlWriter, "Enabled", "False"); xmlWriter.WriteStartElement("Style"); xmlWriter.WriteStartElement("Border"); RdlRender.AddLine(xmlWriter, "Color", "Gainsboro"); xmlWriter.WriteEndElement(); //Border xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartMajorGridLines xmlWriter.WriteStartElement("ChartMinorGridLines"); RdlRender.AddLine(xmlWriter, "Enabled", "False"); xmlWriter.WriteStartElement("Style"); xmlWriter.WriteStartElement("Border"); RdlRender.AddLine(xmlWriter, "Color", "Gainsboro"); RdlRender.AddLine(xmlWriter, "Style", "Dotted"); xmlWriter.WriteEndElement(); //Border xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartMinorGridLines xmlWriter.WriteStartElement("ChartMajorTickMarks"); RdlRender.AddLine(xmlWriter, "IntervalType", "Auto"); xmlWriter.WriteEndElement();//ChartMajorTickMarks xmlWriter.WriteStartElement("ChartMinorTickMarks"); RdlRender.AddLine(xmlWriter, "Length", "0.5"); xmlWriter.WriteEndElement();//ChartMinorTickMarks RdlRender.AddLine(xmlWriter, "CrossAt", "NaN"); RdlRender.AddLine(xmlWriter, "Minimum", "NaN"); RdlRender.AddLine(xmlWriter, "Maximum", "NaN"); RdlRender.AddLine(xmlWriter, "Angle", "-90"); RdlRender.AddLine(xmlWriter, "LabelsAutoFitDisabled", "true"); xmlWriter.WriteStartElement("ChartAxisScaleBreak"); RdlRender.AddLine(xmlWriter, "Style", ""); xmlWriter.WriteEndElement(); //ChartAxisScaleBreak xmlWriter.WriteEndElement(); //ChartAxis xmlWriter.WriteEndElement(); //ChartCategoryAxes xmlWriter.WriteStartElement("ChartValueAxes"); foreach (ChartSeries currentSeries in _seriesItems) { currentSeries.RenderAxes2010(xmlWriter); } xmlWriter.WriteEndElement();//ChartValueAxes xmlWriter.WriteStartElement("ChartThreeDProperties"); RdlRender.AddLine(xmlWriter, "Enabled", "true"); RdlRender.AddLine(xmlWriter, "ProjectionMode", "Perspective"); RdlRender.AddLine(xmlWriter, "Rotation", "7"); RdlRender.AddLine(xmlWriter, "Inclination", "15"); RdlRender.AddLine(xmlWriter, "DepthRatio", "200"); RdlRender.AddLine(xmlWriter, "WallThickness", "2"); RdlRender.AddLine(xmlWriter, "Clustered", "true"); xmlWriter.WriteEndElement();//ChartThreeDProperties xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "BackgroundColor", "White"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); RdlRender.AddLine(xmlWriter, "BackgroundGradientEndColor", "#00ffffff"); RdlRender.AddLine(xmlWriter, "BackgroundHatchType", "None"); RdlRender.AddLine(xmlWriter, "ShadowOffset", "0pt"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartArea xmlWriter.WriteEndElement(); //ChartAreas xmlWriter.WriteStartElement("ChartLegends"); xmlWriter.WriteStartElement("ChartLegend"); xmlWriter.WriteAttributeString("Name", "Default"); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "BackgroundColor", "#ffffff"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); RdlRender.AddLine(xmlWriter, "FontSize", "8pt"); xmlWriter.WriteEndElement();//Style xmlWriter.WriteStartElement("ChartLegendTitle"); xmlWriter.WriteElementString("Caption", null); //RdlRender.AddLine(xmlWriter,"Caption",""); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "FontSize", "8pt"); RdlRender.AddLine(xmlWriter, "FontWeight", "Bold"); RdlRender.AddLine(xmlWriter, "TextAlign", "Center"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartLegendTitle RdlRender.AddLine(xmlWriter, "HeaderSeparatorColor", "#cccccc"); RdlRender.AddLine(xmlWriter, "ColumnSeparatorColor", "#cccccc"); xmlWriter.WriteEndElement(); //ChartLegend xmlWriter.WriteEndElement(); //ChartLegends xmlWriter.WriteStartElement("ChartTitles"); xmlWriter.WriteStartElement("ChartTitle"); xmlWriter.WriteAttributeString("Name", "Default"); RdlRender.AddLine(xmlWriter, "Caption", _title); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); RdlRender.AddLine(xmlWriter, "FontWeight", "Bold"); RdlRender.AddLine(xmlWriter, "TextAlign", "General"); RdlRender.AddLine(xmlWriter, "VerticalAlign", "Top"); RdlRender.AddLine(xmlWriter, "Color", "#eaf5f7"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartTitle xmlWriter.WriteEndElement(); //ChartTitles RdlRender.AddLine(xmlWriter, "Palette", "BrightPastel"); xmlWriter.WriteStartElement("ChartBorderSkin"); RdlRender.AddLine(xmlWriter, "ChartBorderSkinType", "FrameTitle1"); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "BackgroundColor", "#005db3"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); RdlRender.AddLine(xmlWriter, "Color", "#eaf5f7"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartBorderSkin xmlWriter.WriteStartElement("ChartNoDataMessage"); xmlWriter.WriteAttributeString("Name", "NoDataMessage"); RdlRender.AddLine(xmlWriter, "Caption", "No Data Available"); xmlWriter.WriteStartElement("Style"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); RdlRender.AddLine(xmlWriter, "TextAlign", "General"); RdlRender.AddLine(xmlWriter, "VerticalAlign", "Top"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //ChartNoDataMessage RdlRender.AddLine(xmlWriter, "DataSetName", _datasetName); xmlWriter.WriteStartElement("PageBreak"); RdlRender.AddLine(xmlWriter, "BreakLocation", "Start"); xmlWriter.WriteEndElement(); //PageBreak RdlRender.AddLine(xmlWriter, "Top", (1.73825 + (8 * _sortOrder)).ToString() + "in"); // To make charts go below each other "1.73825in"); RdlRender.AddLine(xmlWriter, "Left", "0.5in"); RdlRender.AddLine(xmlWriter, "Height", "7.46875in"); RdlRender.AddLine(xmlWriter, "Width", "7.2492in"); RdlRender.AddLine(xmlWriter, "ZIndex", "1"); xmlWriter.WriteStartElement("Style"); xmlWriter.WriteStartElement("Border"); RdlRender.AddLine(xmlWriter, "Color", "LightGrey"); RdlRender.AddLine(xmlWriter, "Style", "Solid"); xmlWriter.WriteEndElement();//Border RdlRender.AddLine(xmlWriter, "BackgroundColor", "#ffffff"); RdlRender.AddLine(xmlWriter, "BackgroundGradientType", "None"); RdlRender.AddLine(xmlWriter, "BackgroundGradientEndColor", "#ffffff"); xmlWriter.WriteEndElement(); //Style xmlWriter.WriteEndElement(); //Chart }
//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]; }
/// <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]; }