static string GetTableColumns(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; ReportTextBoxControl ColumnCell = new ReportTextBoxControl(); if (columns == null) { return(""); } string strColumnHeirarchy = ""; strColumnHeirarchy = @" <TablixColumns>"; for (int i = 0; i < columns.Length; i++) { ColumnCell = columns[i].ColumnCell; strColumnHeirarchy += @" <TablixColumn> <Width>" + ColumnCell.Size.Width.ToString() + @"cm</Width> </TablixColumn>"; } strColumnHeirarchy += @"</TablixColumns>"; return(strColumnHeirarchy); }
static string GenerateTableHeaderRow(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; ReportTextBoxControl ColumnCell = new ReportTextBoxControl(); ReportDimensions padding = new ReportDimensions(); if (columns == null) { return(""); } string strTableRow = ""; strTableRow = @"<TablixRow> <Height>0.6cm</Height> <TablixCells>"; for (int i = 0; i < columns.Length; i++) { ColumnCell = columns[i].ColumnCell; padding = columns[i].HeaderColumnPadding; strTableRow += @"<TablixCell> <CellContents> " + GenerateHeaderTableTextBox("txtHeader_" + table.ReportName + "_", ColumnCell.Name, columns[i].HeaderText == null || columns[i].HeaderText.Trim() == "" ? ColumnCell.Name : columns[i].HeaderText, false, padding) + @" </CellContents> </TablixCell>"; } strTableRow += @"</TablixCells></TablixRow>"; return(strTableRow); }
static string GenerateTableRow(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; ReportTextBoxControl ColumnCell = new ReportTextBoxControl(); ReportScale colHeight = ColumnCell.Size; ReportDimensions padding = new ReportDimensions(); if (columns == null) { return(""); } string strTableRow = ""; strTableRow = @"<TablixRow> <Height>0.6cm</Height> <TablixCells>"; for (int i = 0; i < columns.Length; i++) { ColumnCell = columns[i].ColumnCell; padding = ColumnCell.Padding; strTableRow += @"<TablixCell> <CellContents> " + GenerateTextBox("txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" </CellContents> </TablixCell>"; } strTableRow += @"</TablixCells></TablixRow>"; return(strTableRow); }
static string GenerateTable(ReportBuilder reportBuilder) { string TableStr = ""; if (reportBuilder != null && reportBuilder.DataSource != null && reportBuilder.DataSource.Tables.Count > 0) { ReportTable table = new ReportTable(); for (int i = 0; i < reportBuilder.Body.ReportControlItems.ReportTable.Length; i++) { table = reportBuilder.Body.ReportControlItems.ReportTable[i]; TableStr += @"<Tablix Name=""table_" + table.ReportName + @"""> <TablixBody> " + GetTableColumns(reportBuilder, table) + @" <TablixRows> " + GenerateTableHeaderRow(reportBuilder, table) + GenerateTableRow(reportBuilder, table) + @" </TablixRows> </TablixBody>" + GetTableColumnHeirarchy(reportBuilder, table) + @" <TablixRowHierarchy> <TablixMembers> <TablixMember> <KeepWithGroup>After</KeepWithGroup> <RepeatOnNewPage>true</RepeatOnNewPage> <KeepTogether>true</KeepTogether> </TablixMember> <TablixMember> <Group Name=""" + table.ReportName + "_Details" + @""" /> </TablixMember> </TablixMembers> </TablixRowHierarchy> <RepeatColumnHeaders>true</RepeatColumnHeaders> <RepeatRowHeaders>true</RepeatRowHeaders> <DataSetName>" + table.ReportName + @"</DataSetName>" + GetSortingDetails(reportBuilder) + @" <Top>0.07056cm</Top> <Left>1cm</Left> <Height>1.2cm</Height> <Width>7.5cm</Width> <ZIndex>1</ZIndex> <Style> <Border> <Style>None</Style> </Border> </Style> </Tablix>"; } } return(TableStr); }
static ReportBuilder InitAutoGenerateReport(ReportBuilder reportBuilder) { if (reportBuilder != null && reportBuilder.DataSource != null && reportBuilder.DataSource.Tables.Count > 0) { DataSet ds = reportBuilder.DataSource; int _TablesCount = ds.Tables.Count; ReportTable[] reportTables = new ReportTable[_TablesCount]; if (reportBuilder.AutoGenerateReport) { for (int j = 0; j < _TablesCount; j++) { DataTable dt = ds.Tables[j]; ReportColumns[] columns = new ReportColumns[dt.Columns.Count]; ReportScale ColumnScale = new ReportScale(); ColumnScale.Width = 4; ColumnScale.Height = 1; ReportDimensions ColumnPadding = new ReportDimensions(); ColumnPadding.Default = 2; for (int i = 0; i < dt.Columns.Count; i++) { columns[i] = new ReportColumns() { ColumnCell = new ReportTextBoxControl() { Name = dt.Columns[i].ColumnName, Size = ColumnScale, Padding = ColumnPadding }, HeaderText = dt.Columns[i].ColumnName, HeaderColumnPadding = ColumnPadding }; } reportTables[j] = new ReportTable() { ReportName = dt.TableName, ReportDataColumns = columns }; } } reportBuilder.Body = new ReportBody(); reportBuilder.Body.ReportControlItems = new ReportItems(); reportBuilder.Body.ReportControlItems.ReportTable = reportTables; } return(reportBuilder); }
static string GetTableColumnHeirarchy(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; if (columns == null) { return(""); } string strColumnHeirarchy = ""; strColumnHeirarchy = @" <TablixColumnHierarchy> <TablixMembers>"; for (int i = 0; i < columns.Length; i++) { strColumnHeirarchy += "<TablixMember />"; } strColumnHeirarchy += @"</TablixMembers> </TablixColumnHierarchy>"; return(strColumnHeirarchy); }