private void GenSingleTableRdlc(string rdlcFileName, TBlockItem BlockItem, bool isDetails) { String DataSetName = BlockItem.TableName; String ModuleName = FClientData.ProviderName.Substring(0, FClientData.ProviderName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(FDTE2.Solution.FullName); String realTableName = CliUtils.GetTableName(ModuleName, DataSetName, SolutionName, "", true); realTableName = WzdUtils.RemoveQuote(realTableName, FClientData.DatabaseType); DataTable dtDataDic = GetDDTable(FClientData.DatabaseType, FClientData.Owner.SelectedAlias, realTableName); XmlDocument doc = new XmlDocument(); doc.Load(rdlcFileName); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ms", ms); nsmgr.AddNamespace("rd", rd); GenDataSources(doc, nsmgr); GenDataSets(doc, nsmgr, BlockItem); ReportTable rt = new ReportTable(BlockItem.TableName); foreach (TBlockFieldItem item in BlockItem.BlockFieldItems) { bool isGroup = false; if (!String.IsNullOrEmpty(item.CheckNull) && item.CheckNull.ToLower() == "true") isGroup = true; ReportColumn rc = new ReportColumn(item.DataField, isGroup); rc.Width = item.Length * 0.2; if (rc.Width == 0) rc.Width = 2; else if (rc.Width < 1) rc.Width = 1; else if (rc.Width > 8) rc.Width = 8; double titleWidth = (item.Description == null ? item.DataField.Length : item.Description.Length) * 0.4; if (rc.Width < titleWidth) rc.Width = titleWidth; rc.TextAlign = item.EditMask; rt.ReportColumns.Add(rc); } XmlNode nBodyRptItems = doc.SelectSingleNode("ms:Report/ms:Body/ms:ReportItems", nsmgr); XmlNode nRect = nBodyRptItems.SelectSingleNode("ms:Rectangle[@Name='rectContainer']", nsmgr); nBodyRptItems.RemoveChild(nRect); //List XmlNode nRectangle1 = doc.CreateElement("Rectangle", nBodyRptItems.NamespaceURI); XmlAttribute aRectangleName1 = doc.CreateAttribute("Name"); aRectangleName1.Value = "rectContainer"; nRectangle1.Attributes.Append(aRectangleName1); XmlNode nReportItems1 = doc.CreateElement("ReportItems", nBodyRptItems.NamespaceURI); nRectangle1.AppendChild(nReportItems1); XmlNode nDataElementOutput1 = doc.CreateElement("DataElementOutput", nBodyRptItems.NamespaceURI); nDataElementOutput1.InnerText = "ContentsOnly"; nRectangle1.AppendChild(nDataElementOutput1); XmlNode nListStyle1 = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); //List.Style.FontFamily XmlNode nFont1 = doc.CreateElement("FontFamily", nBodyRptItems.NamespaceURI); nFont1.InnerText = "Verdana"; nListStyle1.AppendChild(nFont1); nRectangle1.AppendChild(nListStyle1); XmlNode nTop1 = doc.CreateElement("Top", nBodyRptItems.NamespaceURI); nTop1.InnerText = "0cm"; nRectangle1.AppendChild(nTop1); XmlNode nHeight3 = doc.CreateElement("Height", nBodyRptItems.NamespaceURI); nHeight3.InnerText = "5.5cm"; nRectangle1.AppendChild(nHeight3); XmlNode nWidth3 = doc.CreateElement("Width", nBodyRptItems.NamespaceURI); nWidth3.InnerText = "21cm"; nRectangle1.AppendChild(nWidth3); String sHorGaps = "2.54";//rptParams.HorGaps String sVertGaps = "0.64";//rptParams.VertGaps float curLeft = 0.5f; float curTop = 0.5f; if (isDetails) { //XmlNode nLine = doc.CreateElement("Line", nBodyRptItems.NamespaceURI); //XmlAttribute aLineName = doc.CreateAttribute("Name"); //aLineName.Value = "line1"; //nLine.Attributes.Append(aLineName); //nReportItems1.AppendChild(nLine); //XmlNode nTopLine = doc.CreateElement("Top", nBodyRptItems.NamespaceURI); //nTopLine.InnerText = "1.5cm"; //nLine.AppendChild(nTopLine); //XmlNode nHeightLine = doc.CreateElement("Height", nBodyRptItems.NamespaceURI); //nHeightLine.InnerText = "0cm"; //nLine.AppendChild(nHeightLine); //XmlNode nWidthLine = doc.CreateElement("Width", nBodyRptItems.NamespaceURI); //nWidthLine.InnerText = "21cm"; //nLine.AppendChild(nWidthLine); //XmlNode nStyleLine = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); //nLine.AppendChild(nStyleLine); //XmlNode nBorderStyleLine = doc.CreateElement("Border", nBodyRptItems.NamespaceURI); //nStyleLine.AppendChild(nBorderStyleLine); //XmlNode nStyleBorderStyleLine = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); //nStyleBorderStyleLine.InnerText = "Solid"; //nBorderStyleLine.AppendChild(nStyleBorderStyleLine); //XmlNode nFontFamilyStyleLine = doc.CreateElement("FontFamily", nBodyRptItems.NamespaceURI); //nFontFamilyStyleLine.InnerText = "Verdana"; //nStyleLine.AppendChild(nFontFamilyStyleLine); //int layoutIndex = 0; //foreach (var item in BlockItem.Relation.ParentColumns) //{ // string colName = item.ColumnName; // string EditMask = GetFieldEditMask2(dtDataDic, colName); // GenLabel(nReportItems1, curLeft, curTop, "cap" + colName, GetFieldCaption(dtDataDic, colName), sHorGaps, sVertGaps, false); // curLeft += (float)Convert.ToDouble(sHorGaps); // GenLabel(nReportItems1, curLeft, curTop, "txt" + colName, EditMask, sHorGaps, sVertGaps, false); // layoutIndex++; // curLeft += (float)Convert.ToDouble(sHorGaps) + 0.5f; //} } XmlNode nTablix = doc.CreateElement("Tablix", nBodyRptItems.NamespaceURI); XmlAttribute aListName = doc.CreateAttribute("Name"); aListName.Value = "lstContainer"; nTablix.Attributes.Append(aListName); nReportItems1.AppendChild(nTablix); XmlNode nTablixBody = doc.CreateElement("TablixBody", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nTablixBody); XmlNode nTablixColumns = doc.CreateElement("TablixColumns", nBodyRptItems.NamespaceURI); nTablixBody.AppendChild(nTablixColumns); for (int i = 0; i < rt.ReportColumns.Count; i++) { XmlNode nTablixColumn = doc.CreateElement("TablixColumn", nBodyRptItems.NamespaceURI); nTablixColumns.AppendChild(nTablixColumn); XmlNode nWidth = doc.CreateElement("Width", nBodyRptItems.NamespaceURI); nWidth.InnerText = rt.ReportColumns[i].Width.ToString() + "cm"; nTablixColumn.AppendChild(nWidth); } XmlNode nTablixRows = doc.CreateElement("TablixRows", nBodyRptItems.NamespaceURI); nTablixBody.AppendChild(nTablixRows); for (int j = 0; j < 2; j++) { XmlNode nTablixRow = doc.CreateElement("TablixRow", nBodyRptItems.NamespaceURI); nTablixRows.AppendChild(nTablixRow); XmlNode nHeight = doc.CreateElement("Height", nBodyRptItems.NamespaceURI); nHeight.InnerText = "0.64cm"; nTablixRow.AppendChild(nHeight); XmlNode nTablixCells = doc.CreateElement("TablixCells", nBodyRptItems.NamespaceURI); nTablixRow.AppendChild(nTablixCells); //生成Group设置 //if (HasGroupCondition(rt)) //{ // //Grouping // XmlNode nGrouping = doc.CreateElement("Grouping", nTablix.NamespaceURI); // XmlAttribute aGroupingName = doc.CreateAttribute("Name"); // aGroupingName.Value = "lstContainer_Details_" + FClientData.TableName; // nGrouping.Attributes.Append(aGroupingName); // //Grouping.PageBreakAtEnd // XmlNode nPageBreakAtEnd = doc.CreateElement("PageBreakAtEnd", nTablix.NamespaceURI); // nPageBreakAtEnd.InnerText = "true"; // nGrouping.AppendChild(nPageBreakAtEnd); // //Grouping.GroupExpressions // XmlNode nGroupExpressions = doc.CreateElement("GroupExpressions", nTablix.NamespaceURI); // List<ReportColumn> lstGroupConditionFields = GetGroupConditionRptColumns(rt); // foreach (ReportColumn cdtField in lstGroupConditionFields) // { // //Grouping.GroupExpressions.GroupExpression // XmlNode nGroupExpression = doc.CreateElement("GroupExpression", nTablix.NamespaceURI); // nGroupExpression.InnerText = "=Fields!" + cdtField.ColumnName + ".Value"; // nGroupExpressions.AppendChild(nGroupExpression); // } // nGrouping.AppendChild(nGroupExpressions); // nTablix.AppendChild(nGrouping); //} XmlNode startNode = nTablixCells;//;GetStartXPathNode(doc, nsmgr, true, isMaster); //给Title赋值 XmlNode nTitle = GetTitleNode(doc, nsmgr, true); if (nTitle != null) { XmlNode nTitleValue = nTitle.SelectSingleNode("ms:Paragraphs/ms:Paragraph/ms:TextRuns/ms:TextRun/ms:Value", nsmgr); if (nTitleValue != null) { nTitleValue.InnerText = FClientData.FormTitle; } } // Top Init XmlDocument docrealContext = startNode.OwnerDocument; //XmlNode temNode = startNode; for (int i = 0; i < rt.ReportColumns.Count; i++) { string colName = rt.ReportColumns[i].ColumnName; string EditMask = GetFieldEditMask(dtDataDic, colName); string textAlign = rt.ReportColumns[i].TextAlign; curLeft = 0.5f; curTop += 0.94f; //GenLabel if (j == 0) GenTableLabel(startNode, curLeft, curTop, "hd" + colName, GetFieldCaption(dtDataDic, colName), sHorGaps, sVertGaps, false, textAlign); else if (j == 1) GenTableLabel(startNode, curLeft, curTop, "cnt" + colName, EditMask, sHorGaps, sVertGaps, false, textAlign); } //if (!isMaster) //{ // startNode.AppendChild(temNode); //} } //List.Style XmlNode nListStyle = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); //List.Style.FontFamily XmlNode nFont = doc.CreateElement("FontFamily", nBodyRptItems.NamespaceURI); nFont.InnerText = "PMingLiU"; nListStyle.AppendChild(nFont); nTablix.AppendChild(nListStyle); XmlNode nDataSetName = doc.CreateElement("DataSetName", nBodyRptItems.NamespaceURI); nDataSetName.InnerText = "NewDataSet"; nTablix.AppendChild(nDataSetName); XmlNode nTop = doc.CreateElement("Top", nBodyRptItems.NamespaceURI); nTop.InnerText = "0.1cm"; nTablix.AppendChild(nTop); XmlNode nLeft = doc.CreateElement("Left", nBodyRptItems.NamespaceURI); nLeft.InnerText = "0.5cm"; nTablix.AppendChild(nLeft); XmlNode nHeight2 = doc.CreateElement("Height", nBodyRptItems.NamespaceURI); nHeight2.InnerText = "1.28cm"; nTablix.AppendChild(nHeight2); XmlNode nWidth2 = doc.CreateElement("Width", nBodyRptItems.NamespaceURI); nWidth2.InnerText = "10.16cm"; nTablix.AppendChild(nWidth2); nBodyRptItems.AppendChild(nRectangle1); //GenReportBodyHeight(doc, curTop, nsmgr, isMaster); XmlNode nTablixColumnHierarchy = doc.CreateElement("TablixColumnHierarchy", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nTablixColumnHierarchy); XmlNode nTablixMembers = doc.CreateElement("TablixMembers", nBodyRptItems.NamespaceURI); nTablixColumnHierarchy.AppendChild(nTablixMembers); for (int i = 0; i < rt.ReportColumns.Count; i++) { XmlNode nTablixMember = doc.CreateElement("TablixMember", nBodyRptItems.NamespaceURI); nTablixMembers.AppendChild(nTablixMember); } if (HasGroupCondition(rt)) { CreateGroup(nTablix, doc, rt, dtDataDic, nBodyRptItems); } else { XmlNode nTablixRowHierarchy = doc.CreateElement("TablixRowHierarchy", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nTablixRowHierarchy); XmlNode nTablixMembers2 = doc.CreateElement("TablixMembers", nBodyRptItems.NamespaceURI); nTablixRowHierarchy.AppendChild(nTablixMembers2); XmlNode nTablixMember3 = doc.CreateElement("TablixMember", nBodyRptItems.NamespaceURI); nTablixMembers2.AppendChild(nTablixMember3); XmlNode nKeepWithGroup = doc.CreateElement("KeepWithGroup", nBodyRptItems.NamespaceURI); nKeepWithGroup.InnerText = "After"; nTablixMember3.AppendChild(nKeepWithGroup); XmlNode nRepeatOnNewPage = doc.CreateElement("RepeatOnNewPage", nBodyRptItems.NamespaceURI); nRepeatOnNewPage.InnerText = "true"; nTablixMember3.AppendChild(nRepeatOnNewPage); XmlNode nKeepTogether = doc.CreateElement("KeepTogether", nBodyRptItems.NamespaceURI); nKeepTogether.InnerText = "true"; nTablixMember3.AppendChild(nKeepTogether); XmlNode nTablixMember2 = doc.CreateElement("TablixMember", nBodyRptItems.NamespaceURI); nTablixMembers2.AppendChild(nTablixMember2); XmlNode nGroup = doc.CreateElement("Group", nBodyRptItems.NamespaceURI); XmlAttribute aGroupName = doc.CreateAttribute("Name"); aGroupName.Value = "lstContainer_Details_Group"; nGroup.Attributes.Append(aGroupName); nTablixMember2.AppendChild(nGroup); XmlNode nTablixMembers3 = doc.CreateElement("TablixMembers", nBodyRptItems.NamespaceURI); nTablixMember2.AppendChild(nTablixMembers3); XmlNode nTablixMember4 = doc.CreateElement("TablixMember", nBodyRptItems.NamespaceURI); nTablixMembers3.AppendChild(nTablixMember4); XmlNode nDataElementName = doc.CreateElement("DataElementName", nBodyRptItems.NamespaceURI); nDataElementName.InnerText = "Item"; nGroup.AppendChild(nDataElementName); XmlNode nDataElementName2 = doc.CreateElement("DataElementName", nBodyRptItems.NamespaceURI); nDataElementName2.InnerText = "Item_Collection"; nTablixMember2.AppendChild(nDataElementName2); XmlNode nDataElementOutput = doc.CreateElement("DataElementOutput", nBodyRptItems.NamespaceURI); nDataElementOutput.InnerText = "Output"; nTablixMember2.AppendChild(nDataElementOutput); XmlNode nKeepTogether2 = doc.CreateElement("KeepTogether", nBodyRptItems.NamespaceURI); nKeepTogether2.InnerText = "true"; nTablixMember2.AppendChild(nKeepTogether2); } if (isDetails) { XmlNode nFilters = doc.CreateElement("Filters", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nFilters); foreach (var item in BlockItem.Relation.ParentColumns) { XmlNode nFilter = doc.CreateElement("Filter", nBodyRptItems.NamespaceURI); nFilters.AppendChild(nFilter); XmlNode nFilterExpression = doc.CreateElement("FilterExpression", nBodyRptItems.NamespaceURI); nFilterExpression.InnerText = "=Fields!" + item.ColumnName + ".Value"; nFilter.AppendChild(nFilterExpression); XmlNode nOperator = doc.CreateElement("Operator", nBodyRptItems.NamespaceURI); nOperator.InnerText = "Equal"; nFilter.AppendChild(nOperator); XmlNode nFilterValues = doc.CreateElement("FilterValues", nBodyRptItems.NamespaceURI); nFilter.AppendChild(nFilterValues); XmlNode nFilterValue = doc.CreateElement("FilterValue", nBodyRptItems.NamespaceURI); nFilterValue.InnerText = "=Parameters!p" + item.ColumnName + ".Value"; nFilterValues.AppendChild(nFilterValue); } GenReportParameters(doc, nsmgr, BlockItem); } doc.Save(rdlcFileName); }
private void GenSingleLabelRdlc(string rdlcFileName, TBlockItem BlockItem, bool isMaster, String detailsRptFileName = "", DataColumn[] relationColumns = null) { String DataSetName = BlockItem.TableName; String ModuleName = FClientData.ProviderName.Substring(0, FClientData.ProviderName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(FDTE2.Solution.FullName); String realTableName = CliUtils.GetTableName(ModuleName, DataSetName, SolutionName, "", true); realTableName = WzdUtils.RemoveQuote(realTableName, FClientData.DatabaseType); DataTable dtDataDic = GetDDTable(FClientData.DatabaseType, FClientData.Owner.SelectedAlias, realTableName); XmlDocument doc = new XmlDocument(); doc.Load(rdlcFileName); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ms", ms); nsmgr.AddNamespace("rd", rd); GenDataSources(doc, nsmgr); GenDataSets(doc, nsmgr, BlockItem); ReportTable rt = new ReportTable(BlockItem.TableName); foreach (TBlockFieldItem item in BlockItem.BlockFieldItems) { bool isGroup = false; if (!String.IsNullOrEmpty(item.CheckNull) && item.CheckNull.ToLower() == "true") isGroup = true; ReportColumn rc = new ReportColumn(item.DataField, isGroup); rc.TextAlign = item.EditMask; rt.ReportColumns.Add(rc); } //GenList(doc, nsmgr, rt, FClientData.TableName); XmlNode nBodyRptItems = doc.SelectSingleNode("ms:Report/ms:Body/ms:ReportItems", nsmgr); XmlNode nRect = nBodyRptItems.SelectSingleNode("ms:Rectangle[@Name='rectContainer']", nsmgr); nBodyRptItems.RemoveChild(nRect); //List XmlNode nTablix = doc.CreateElement("Tablix", nBodyRptItems.NamespaceURI); XmlAttribute aListName = doc.CreateAttribute("Name"); aListName.Value = "lstContainer"; nTablix.Attributes.Append(aListName); XmlNode nTablixBody = doc.CreateElement("TablixBody", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nTablixBody); XmlNode nTablixColumns = doc.CreateElement("TablixColumns", nBodyRptItems.NamespaceURI); nTablixBody.AppendChild(nTablixColumns); XmlNode nTablixColumn = doc.CreateElement("TablixColumn", nBodyRptItems.NamespaceURI); nTablixColumns.AppendChild(nTablixColumn); XmlNode nWidth = doc.CreateElement("Width", nBodyRptItems.NamespaceURI); nWidth.InnerText = "21cm"; nTablixColumn.AppendChild(nWidth); XmlNode nTablixRows = doc.CreateElement("TablixRows", nBodyRptItems.NamespaceURI); nTablixBody.AppendChild(nTablixRows); XmlNode nTablixRow = doc.CreateElement("TablixRow", nBodyRptItems.NamespaceURI); nTablixRows.AppendChild(nTablixRow); XmlNode nHeight = doc.CreateElement("Height", nBodyRptItems.NamespaceURI); nHeight.InnerText = "4.9cm"; nTablixRow.AppendChild(nHeight); XmlNode nTablixCells = doc.CreateElement("TablixCells", nBodyRptItems.NamespaceURI); nTablixRow.AppendChild(nTablixCells); XmlNode nTablixCell = doc.CreateElement("TablixCell", nBodyRptItems.NamespaceURI); nTablixCells.AppendChild(nTablixCell); XmlNode nCellContents = doc.CreateElement("CellContents", nBodyRptItems.NamespaceURI); nTablixCell.AppendChild(nCellContents); XmlNode nRectangle = doc.CreateElement("Rectangle", nBodyRptItems.NamespaceURI); XmlAttribute aRectangleName = doc.CreateAttribute("Name"); aRectangleName.Value = "lstContainer_Contents"; nRectangle.Attributes.Append(aRectangleName); nCellContents.AppendChild(nRectangle); XmlNode nReportItems = doc.CreateElement("ReportItems", nBodyRptItems.NamespaceURI); nRectangle.AppendChild(nReportItems); XmlNode nRectangle2 = doc.CreateElement("Rectangle", nBodyRptItems.NamespaceURI); XmlAttribute aRectangle2Name = doc.CreateAttribute("Name"); aRectangle2Name.Value = "rectContainer"; nRectangle2.Attributes.Append(aRectangle2Name); nReportItems.AppendChild(nRectangle2); //生成Group设置 if (HasGroupCondition(rt)) { //Grouping XmlNode nGrouping = doc.CreateElement("Grouping", nTablix.NamespaceURI); XmlAttribute aGroupingName = doc.CreateAttribute("Name"); aGroupingName.Value = "lstContainer_Details_" + FClientData.TableName; nGrouping.Attributes.Append(aGroupingName); //Grouping.PageBreakAtEnd XmlNode nPageBreakAtEnd = doc.CreateElement("PageBreakAtEnd", nTablix.NamespaceURI); nPageBreakAtEnd.InnerText = "true"; nGrouping.AppendChild(nPageBreakAtEnd); //Grouping.GroupExpressions XmlNode nGroupExpressions = doc.CreateElement("GroupExpressions", nTablix.NamespaceURI); List<ReportColumn> lstGroupConditionFields = GetGroupConditionRptColumns(rt); foreach (ReportColumn cdtField in lstGroupConditionFields) { //Grouping.GroupExpressions.GroupExpression XmlNode nGroupExpression = doc.CreateElement("GroupExpression", nTablix.NamespaceURI); nGroupExpression.InnerText = "=Fields!" + cdtField.ColumnName + ".Value"; nGroupExpressions.AppendChild(nGroupExpression); } nGrouping.AppendChild(nGroupExpressions); nTablix.AppendChild(nGrouping); } //List.Style XmlNode nListStyle = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); //List.Style.FontFamily XmlNode nFont = doc.CreateElement("FontFamily", nBodyRptItems.NamespaceURI); nFont.InnerText = "PMingLiU"; nListStyle.AppendChild(nFont); nTablix.AppendChild(nListStyle); nBodyRptItems.AppendChild(nTablix); XmlNode startNode = nRectangle2;//;GetStartXPathNode(doc, nsmgr, true, isMaster); //给Title赋值 XmlNode nTitle = GetTitleNode(doc, nsmgr, true); if (nTitle != null) { XmlNode nTitleValue = nTitle.SelectSingleNode("ms:Paragraphs/ms:Paragraph/ms:TextRuns/ms:TextRun/ms:Value", nsmgr); if (nTitleValue != null) { nTitleValue.InnerText = FClientData.FormTitle; } } #region GenDataRegion // Top Init float curLeft = 0.5f; float curTop = 0.5f; int layoutIndex = 0; XmlDocument docrealContext = startNode.OwnerDocument; XmlNode temNode = startNode; //if (!isMaster) //{ temNode = docrealContext.CreateElement("ReportItems", temNode.NamespaceURI); //} int iLayoutColumnNum = 2;// rptParams.LayoutColumnNum String sHorGaps = "2.54";//rptParams.HorGaps String sVertGaps = "0.64";//rptParams.VertGaps for (int i = 0; i < rt.ReportColumns.Count; i++) { string colName = rt.ReportColumns[i].ColumnName; string EditMask = GetFieldEditMask(dtDataDic, colName); string textAlign = rt.ReportColumns[i].TextAlign; if (layoutIndex >= iLayoutColumnNum) { layoutIndex = 0; curLeft = 0.5f; curTop += 0.94f; //GenLabel GenLabel(temNode, curLeft, curTop, "lbl" + colName, GetFieldCaption(dtDataDic, colName) + ":", sHorGaps, sVertGaps, false, ""); //GenrTextBox curLeft += (float)Convert.ToDouble(sHorGaps); GenLabel(temNode, curLeft, curTop, "txt" + colName, EditMask, sHorGaps, sVertGaps, false, textAlign); layoutIndex++; curLeft += (float)Convert.ToDouble(sHorGaps) + 0.5f; } else { //GenLabel GenLabel(temNode, curLeft, curTop, "lbl" + colName, GetFieldCaption(dtDataDic, colName) + ":", sHorGaps, sVertGaps, false, ""); //GenrTextBox curLeft += (float)Convert.ToDouble(sHorGaps); GenLabel(temNode, curLeft, curTop, "txt" + colName, EditMask, sHorGaps, sVertGaps, false, textAlign); layoutIndex++; curLeft += (float)Convert.ToDouble(sHorGaps) + 0.5f; } } //if (!isMaster) //{ startNode.AppendChild(temNode); //} XmlNode nStyleRectangle = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); startNode.AppendChild(nStyleRectangle); XmlNode nBorderStyleRectangle = doc.CreateElement("Border", nBodyRptItems.NamespaceURI); nStyleRectangle.AppendChild(nBorderStyleRectangle); XmlNode nStyleBorderStyleRectangle = doc.CreateElement("Style", nBodyRptItems.NamespaceURI); nStyleBorderStyleRectangle.InnerText = "Solid"; nBorderStyleRectangle.AppendChild(nStyleBorderStyleRectangle); if (isMaster) { //nBodyRptItems XmlNode nSubreport = doc.CreateElement("Subreport", nBodyRptItems.NamespaceURI); XmlAttribute aSubreportName = doc.CreateAttribute("Name"); aSubreportName.Value = "subreport1"; nSubreport.Attributes.Append(aSubreportName); temNode.AppendChild(nSubreport); XmlNode nReportName = doc.CreateElement("ReportName", nBodyRptItems.NamespaceURI); nReportName.InnerText = detailsRptFileName; nSubreport.AppendChild(nReportName); XmlNode nKeepTogether1 = doc.CreateElement("KeepTogether", nBodyRptItems.NamespaceURI); nKeepTogether1.InnerText = "true"; nSubreport.AppendChild(nKeepTogether1); XmlNode nTopSubreport = doc.CreateElement("Top", nBodyRptItems.NamespaceURI); nTopSubreport.InnerText = "9.8cm"; nSubreport.AppendChild(nTopSubreport); XmlNode nHeightSubreport = doc.CreateElement("Height", nBodyRptItems.NamespaceURI); nHeightSubreport.InnerText = "9.6cm"; nSubreport.AppendChild(nHeightSubreport); XmlNode nWidthSubreport = doc.CreateElement("Width", nBodyRptItems.NamespaceURI); nWidthSubreport.InnerText = "21cm"; nSubreport.AppendChild(nWidthSubreport); //Parameters XmlNode nParameters = doc.CreateElement("Parameters", nBodyRptItems.NamespaceURI); foreach (DataColumn col in relationColumns) { //Parameters.Parameter XmlNode nParameter = doc.CreateElement("Parameter", nBodyRptItems.NamespaceURI); XmlAttribute aParamName = doc.CreateAttribute("Name"); aParamName.Value = "p" + col.ColumnName; nParameter.Attributes.Append(aParamName); //Parameters.Parameter.Value string EditMask = GetFieldEditMask(dtDataDic, col.ColumnName); XmlNode nParamValue = doc.CreateElement("Value", nBodyRptItems.NamespaceURI); nParamValue.InnerText = EditMask; nParameter.AppendChild(nParamValue); nParameters.AppendChild(nParameter); } nSubreport.AppendChild(nParameters); } GenReportBodyHeight(doc, curTop, nsmgr, isMaster); #endregion XmlNode nTablixColumnHierarchy = doc.CreateElement("TablixColumnHierarchy", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nTablixColumnHierarchy); XmlNode nTablixMembers = doc.CreateElement("TablixMembers", nBodyRptItems.NamespaceURI); nTablixColumnHierarchy.AppendChild(nTablixMembers); XmlNode nTablixMember = doc.CreateElement("TablixMember", nBodyRptItems.NamespaceURI); nTablixMembers.AppendChild(nTablixMember); XmlNode nTablixRowHierarchy = doc.CreateElement("TablixRowHierarchy", nBodyRptItems.NamespaceURI); nTablix.AppendChild(nTablixRowHierarchy); XmlNode nTablixMembers2 = doc.CreateElement("TablixMembers", nBodyRptItems.NamespaceURI); nTablixRowHierarchy.AppendChild(nTablixMembers2); XmlNode nTablixMember2 = doc.CreateElement("TablixMember", nBodyRptItems.NamespaceURI); nTablixMembers2.AppendChild(nTablixMember2); XmlNode nGroup = doc.CreateElement("Group", nBodyRptItems.NamespaceURI); XmlAttribute aGroupName = doc.CreateAttribute("Name"); aGroupName.Value = "lstContainer_Details_Group"; nGroup.Attributes.Append(aGroupName); nTablixMember2.AppendChild(nGroup); XmlNode nDataElementName = doc.CreateElement("DataElementName", nBodyRptItems.NamespaceURI); nDataElementName.InnerText = "Item"; nGroup.AppendChild(nDataElementName); XmlNode nDataElementName2 = doc.CreateElement("DataElementName", nBodyRptItems.NamespaceURI); nDataElementName2.InnerText = "Item_Collection"; nTablixMember2.AppendChild(nDataElementName2); XmlNode nDataElementOutput = doc.CreateElement("DataElementOutput", nBodyRptItems.NamespaceURI); nDataElementOutput.InnerText = "Output"; nTablixMember2.AppendChild(nDataElementOutput); XmlNode nKeepTogether = doc.CreateElement("KeepTogether", nBodyRptItems.NamespaceURI); nKeepTogether.InnerText = "true"; nTablixMember2.AppendChild(nKeepTogether); doc.Save(rdlcFileName); }