示例#1
0
        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);
        }
示例#2
0
        static string GenerateTableFooterRow(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]  columns = table.ReportDataColumns;
            ReportDimensions padding = new ReportDimensions();

            if (columns == null)
            {
                return("");
            }

            string strTableRow = "";

            strTableRow = @"<TablixRow>
                <Height>0.6cm</Height> 
                <TablixCells>";

            strTableRow += @"<TablixCell> 
                  <CellContents> 

                   " + GenerateFooterTableTextBox(reportBuilder, "txtFooter_" + table.ReportName + "_", "TableFooter158", $"count - {reportBuilder.TableRows}", padding) + $@" 
                  <ColSpan>{columns.Length}</ColSpan>
                  </CellContents> 
                </TablixCell>{string.Join(" ", Enumerable.Repeat("<TablixCell />", (columns.Length - 1)))}";

            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
示例#3
0
        static string GenerateTableHeaderRow(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]  columns = table.ReportDataColumns;
            ReportDimensions padding = new ReportDimensions();

            if (columns == null)
            {
                return("");
            }
            string strTableRow = @"<TablixRow>
                <Height>0.6cm</Height> 
                <TablixCells>";

            for (int i = 0; i < columns.Length; i++)
            {
                padding      = columns[i].HeaderColumnPadding;
                strTableRow += @"<TablixCell> 
                  <CellContents> 
                  
                   " + GenerateHeaderTableTextBox(reportBuilder, "txtHeader_" + table.ReportName + "_", columns[i].ColumnCell.Name, columns[i].HeaderText == null || columns[i].HeaderText.Trim() == "" ? columns[i].ColumnCell.Name : columns[i].HeaderText, padding) + @" 

                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
示例#4
0
        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> 
                   " + GenerateTableRowTextBox(reportBuilder, "txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" 
                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
示例#5
0
        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) + GenerateTableFooterRow(reportBuilder, table) + @" 
          </TablixRows> 
        </TablixBody>" + GetTableColumnHeirarchy(reportBuilder, table) + @" 
        <TablixRowHierarchy> 
          <TablixMembers> 
            <TablixMember> 
              <KeepWithGroup>After</KeepWithGroup> 
            </TablixMember> 
            <TablixMember> 
              <Group Name=""" + table.ReportName + "_Details" + $@""" /> 
            </TablixMember> 
            <TablixMember>
              <KeepWithGroup>Before</KeepWithGroup>
            </TablixMember>
          </TablixMembers> 
        </TablixRowHierarchy> 
        <RepeatColumnHeaders>true</RepeatColumnHeaders> 
        <RepeatRowHeaders>true</RepeatRowHeaders> 
        <DataSetName>" + table.ReportName + @"</DataSetName>" + @" 
        <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);
        }
示例#6
0
        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  = ((reportBuilder.Page.PageSize.Width - 2) / dt.Columns.Count);
                        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.Replace(" ", "_"), 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);
        }
示例#7
0
        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);
        }