Duplicate rows for Export to Excel & CSV only

6 posts, 0 answers
  1. Nandan
    Nandan avatar
    18 posts
    Member since:
    Jun 2010

    Posted 28 Jan Link to this post

    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.

  2. Todor
    Admin
    Todor avatar
    267 posts

    Posted 31 Jan Link to this post

    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
  3. Nandan
    Nandan avatar
    18 posts
    Member since:
    Jun 2010

    Posted 01 Feb in reply to Todor Link to this post

    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

     

     

  4. Todor
    Admin
    Todor avatar
    267 posts

    Posted 06 Feb Link to this post

    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
  5. Nandan
    Nandan avatar
    18 posts
    Member since:
    Jun 2010

    Posted 06 Feb in reply to Todor Link to this post

    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

  6. Todor
    Admin
    Todor avatar
    267 posts

    Posted 11 Feb Link to this post

    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
Back to Top