Beispiel #1
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);
        }
Beispiel #2
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);
        }