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.