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

Report keeps repeating itself in pdf or word format

4 Answers 254 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 26 Sep 2011, 02:47 PM
I've created a report containing three different grids on the same report.  I did this by placing three different Table Wizards on the same Details section of the the report designer.  It works great when displayed as an html page. The problem however, is when i export it to pdf, exel, or word.  The report just keeps repeating intself for 49 pages.  Forty nine pages of the same data grids repeating over and over again.  Has anyone had this problem before?  One solution might be to use a BookReport that displays just one grid at a time but I would like not to have to start all over again. 

Thanks, Rick Pace.

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 28 Sep 2011, 05:37 PM
Hello Rick,

It seems that you have used a data item (subreport, table, list or crosstab) in the report's detail section. However the data items are a separate data regions and they not make use of the report's data source. They have their own DataSource property which you have set in order to populate the item with data. However if you have in addition set the Report.DataSource property. The report engine will create a detail section with the data item for every row of your datasource. To avoid this behavior our suggestion is to set the Report.DataSource property to none or move the table item to another non repeating section such as report header or unbound group header (group without grouping).

Greetings,
Peter
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Manognya
Top achievements
Rank 1
answered on 08 Apr 2014, 03:30 PM
Hi,

I am using table in the report header section.
The column names are populating properly. but the 1st column data is displayed in all other columns.

Below is the code that iam using,

     
private void DReport3_NeedDataSource(object sender, EventArgs e)
{
    DataSet ds = new DataSet();
   
 
    string strsqlconn = ConfigurationManager.ConnectionStrings["Myconn"].ConnectionString;
 
    SqlConnection sqlConnection1 = new SqlConnection(strsqlconn);
    SqlCommand cmd = new SqlCommand();
    SqlDataAdapter DA = new SqlDataAdapter();
 
    cmd.CommandText = "SELECT * FROM user";
    cmd.CommandType = CommandType.Text;
    cmd.Connection = sqlConnection1;
    DA.SelectCommand = cmd;
 
    sqlConnection1.Open();
    DA.Fill(ds);
    (sender as Telerik.Reporting.Processing.Report).DataSource = ds;
    table1.DataSource = ds.Tables[0];
    Telerik.Reporting.HtmlTextBox textboxGroup;
    Telerik.Reporting.HtmlTextBox textBoxTable;
    table1.ColumnGroups.Clear();
    table1.Body.Columns.Clear();
    table1.Body.Rows.Clear();
    int ColCount = ds.Tables[0].Columns.Count;
 
    for (int i = 0; i <= ColCount - 1; i++)
    {
 
 
        Telerik.Reporting.TableGroup tableGroupColumn = new Telerik.Reporting.TableGroup();
        table1.ColumnGroups.Add(tableGroupColumn);
        //table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
 
        textboxGroup = new Telerik.Reporting.HtmlTextBox();
        textboxGroup.Style.BorderColor.Default = Color.Black;
        textboxGroup.Style.BorderStyle.Default = BorderType.Solid;
        textboxGroup.Value = ds.Tables[0].Columns[i].ColumnName;
        textboxGroup.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
        tableGroupColumn.ReportItem = textboxGroup;
 
        textBoxTable = new Telerik.Reporting.HtmlTextBox();
        //textBoxTable.Style.BorderColor.Default = Color.Black;
        //textBoxTable.Style.BorderStyle.Default = BorderType.Solid;
        textBoxTable.Value = "=Fields." + ds.Tables[0].Columns[i].ColumnName;
        textBoxTable.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
        table1.Body.SetCellContent(0, i, textBoxTable);
        table1.Items.AddRange(new ReportItemBase[] { textBoxTable, textboxGroup });
 
    }
 
}


Thanks,
Manognya.K
0
Nasko
Telerik team
answered on 11 Apr 2014, 01:59 PM
Hello Manognya,

This behavior can be observed when the TableGroups' names are not unique and the same name is set by default for each group. To avoid this you should explicitly set a unique name for each TableGroup group that you add e.g.:
tableGroupColumn.Name = "TableGroup" + i.ToString();

where i is unique in the scope of the table.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Manognya
Top achievements
Rank 1
answered on 22 Apr 2014, 12:20 PM
Thanks that solved my problem!
Tags
General Discussions
Asked by
Rick
Top achievements
Rank 1
Answers by
Peter
Telerik team
Manognya
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or