This is a migrated thread and some comments may be shown as answers.

Multiple column information when using reports

0 Answers 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 26 Nov 2018, 03:43 PM

 

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

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Roger
Top achievements
Rank 1
Share this question
or