Exemple #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> 
                   " + GenerateTextBox("txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" 
                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
    static ReportBuilder InitAutoGenerateReport(ReportBuilder reportBuilder, int[] lista)
    {
        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];
                    ReportDimensions ColumnPadding = new ReportDimensions();
                    ColumnPadding.Default = 2;
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        ReportScale ColumnScale = new ReportScale();
                        // ColumnScale.Width = 4;
                        ColumnScale.Height = 1;
                        ColumnScale.Width  = 0.25 * lista[i];
                        TamanoTitulo      += (0.25 * lista[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 GenerateFirstWhiteSpacesRow(ReportBuilder reportBuilder, ReportTable table, string filter)
    {
        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++)
        {
            if (i == 0)
            {
                ColumnCell   = columns[i].ColumnCell;
                padding      = ColumnCell.Padding;
                strTableRow += @"<TablixCell> 
                              <CellContents> 
                               " + GenerateFirstRowWhiteTextBox(filter, filter, ColumnCell.Name, "", true, padding) + @" 
                              </CellContents> 
                            </TablixCell>";
            }
            else
            {
                count       += 3;
                ColumnCell   = columns[i].ColumnCell;
                padding      = ColumnCell.Padding;
                strTableRow += @"<TablixCell />";
            }
        }
        strTableRow += @"</TablixCells>
                    </TablixRow>";

        return(strTableRow);
    }