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

Duplicate rows for Export to Excel & CSV only

5 Answers 875 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nandan
Top achievements
Rank 1
Nandan asked on 28 Jan 2019, 02:49 PM

I just encountered an strange issue where for one of the reports I am getting duplicate records in the excel/csv sheet for the exported report. For PDF there are no duplicates which is correct. Duplicate rows are there only for “Export to Excel” and “Export to CSV” options. In ReportViewer of course it is not displaying any duplicate records.
The report contains Header, Footer and Detail sections. In Header & Detail sections we are dynamically generating columns using the sample code given below:
private void MyReport_NeedDataSource(object sender, EventArgs e)
{
             var ds= //Some data source
             ((Telerik.Reporting.Processing.Report)sender).DataSource =ds //Set datasource from above dataset;

             //Create columns from the ds (generated from data source)
            for (int idx = 1; idx < ds.Tables[0].Columns.Count; idx++)
            {
                 column = ds.Tables[0].Columns[idx];   
                 var label = SetupLabel(column.ColumnName, string.Format("# of {0}", caption), width, LABELHEIGHT, locX, yLabel, HorizontalAlign.Right,                                                                          VerticalAlign.Bottom);
                  var textbox = SetupTextBox(column.ColumnName,width,TEXTHEIGHT,locX,yText);
                  if (Items.Find("labelsGroupHeader", true).Any())
                  {
                      var labelsGroupHeader1 = (GroupHeaderSection)(Items.Find("labelsGroupHeader", true)[0]);
                      labelsGroupHeader1.Items.Add(label);
                  }
                  if (Items.Find("detail", true).Any())
                  {
                      var detail1 = (DetailSection)(Items.Find("detail", true)[0]);
                      detail1.Items.Add(textbox);
                  }  
            }           
}

We are using Telerik.Reporting.dll 12.2.18.912.
Any immediate help will be much appreciated.

Thanks.

5 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 31 Jan 2019, 11:29 AM
Hello Nandan,

The processing phase of the report is generally the same for all supported export formats. It is strange that in PDF the exported document is as expected, and in Excel and CSV there are duplicate rows. In the code, I cannot see any obvious rendering extension - dependent logic - see RenderingFormat Global Object.
I tested with a custom report (attached) mimicking the approach as seen from the code snippet and was *not* able to reproduce the issue.
We would need a runnable project demonstrating the issue for local investigation. You may consider modifying the attached project to replicate the problem and send it back (e.g.in a support ticket).

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Nandan
Top achievements
Rank 1
answered on 01 Feb 2019, 08:17 AM

Hi,

You have added Table inside Detail, but we are directly adding text boxes in the Detail Section. Also the number of columns and rows are dynamic.

Thanks

 

 

0
Todor
Telerik team
answered on 06 Feb 2019, 08:01 AM
Hi Nandan,

As seen from the code, it adds dynamically report items (i.e. TextBoxes) to the Group Header and Detail sections. It uses methods with custom code that is unknown for us - SetupTextBox and SetupLabel. The number of items added depends on a data source that is not accessible on our end.
Based on the provided information we cannot reproduce the problem. Consider opening a support ticket and providing a runnable sample that demonstrates it.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Nandan
Top achievements
Rank 1
answered on 07 Feb 2019, 04:39 AM

Hi,

We haven't have any custom logic inside those methods, apart from styling Labels and Textboxes. After styling those we are directly adding into Group Header and Detail section. I can't share any example because of our corporate policy. it would be great If you can change your example by adding Group Header and Detail section.

 

Thanks,

Nandan

0
Todor
Telerik team
answered on 11 Feb 2019, 05:53 PM
Hi Nandan,

I have attached a sample creating a band report with C# code in the report constructor. The report is rendered correctly on our end in all export formats. You may test the demo and modify it to replicate the issue.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Nandan
Top achievements
Rank 1
Answers by
Todor
Telerik team
Nandan
Top achievements
Rank 1
Share this question
or