Multiple column information when using reports

1 posts, 0 answers
  1. Roger
    Roger avatar
    1 posts
    Member since:
    Nov 2018

    Posted 26 Nov 2018 Link to this post

     

    I'm trying to do a report with one table composed with 2 rows of diferent information. Table seems to get the correct values for both rows but after creating the render pdf file all the columns have the same values.

    There's the code I use:

                ObjectDataSource dataSource = new ObjectDataSource();
                dataSource.DataSource = typeof(ReportInformation);
                dataSource.DataMember = "Member";
                _Table.DataSource = dataSource;

               

     // -------------------- First I configure the column header  ----------------------------- //

                ColumnsDataModel columns = GetColumnsByUser();
                int numFields = columns.Count;
                for (int ii = 0; ii < numFields; ii++)
                {
                    ColumnsInformation column = columns.Fields[ii];
                    _Table.Body.Columns.Add(new TableBodyColumn(Unit.Pixel(column.Width)));

                    TableGroup tableGroup = new TableGroup();
                    TextBox tb = new TextBox()
                    {
                        Value = columns.Fields[ii].Name,
                        Size = new SizeU(Unit.Cm(6.0), Unit.Cm(1.0))
                    };
                    tableGroup.ReportItem = tb;
                    _Table.ColumnGroups.Add(tableGroup);
                    _Table.Items.Add(tb);
                }

                TableGroup rowGroup = new TableGroup();
               
                // ----------------- Then the table body (Rows) ------------------- //


                for (int jj = 0; jj <rows.Count ; jj++)
                {
                    rowGroup.Groupings.Add(new Grouping(null));
                    _Table.RowGroups.Add(rowGroup);
                    _Table.Body.Rows.Add(new TableBodyRow(Unit.Cm(0.6)));

                    for (int ii = 0; ii < numFields; ii++)
                    {
                    
                        TextBox tb = new TextBox();
                        tb.Size = new SizeU(Unit.Cm(6.0), Unit.Cm(0.6));
                        tb.Value = cell_value;
                        
                        _Table.Items.Add(tb);
                        _Table.Body.SetCellContent(jj, ii, tb);
                    }
                }
            }

    Strangelly If I change that "jj" in SetCellContent for a 0 it displays one row twice and "jj" displays the other one twice

    Best regards

Back to Top