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

Exports to CSV contains header as textbox name

36 Answers 2675 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nisha
Top achievements
Rank 1
Nisha asked on 29 Jun 2012, 09:22 AM
Hi,

    I am exporting the report to CSV from report viewer.The report is generated, but it includes the textbox controls name as header. I have attached the screenshot of the CSV file which i have exported. Is there any way to fix this?


Thanks,
Nisha

36 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 02 Jul 2012, 03:27 PM
Hello Nisha,

You can easily control the CSV export behaviour using the CSV Device Information Settings. In your particular case you have to use the NoHeader setting and set it to True.

Regards,
IvanY
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Nisha
Top achievements
Rank 1
answered on 04 Jul 2012, 09:10 AM
Hi,

   I am using Reporting Q2 2011 version and telerik reporting version is 5.1.11.928. As you told to change the CSV Device Information settings but it is not available in this version. Where i can change these settings. Please help to solve this issue.



Thanks,
Nisha
0
Nisha
Top achievements
Rank 1
answered on 10 Jul 2012, 07:18 PM
Hi,

    As i need to complete my issues in urgent basis. Please help me to resolve this issue asap.


Thanks,
Nisha 
0
Nisha
Top achievements
Rank 1
answered on 12 Jul 2012, 11:13 AM
Hi,

    Please help me to resolve this issue asap. 

Thanks,
Nisha 
0
Hetal
Top achievements
Rank 1
answered on 12 Oct 2012, 04:53 PM
Hi Nisha,

Is your issue of textbox control on report heading was solved?
if yes, then can you send me that solution please?

thank you,
Hetal
0
IvanY
Telerik team
answered on 15 Oct 2012, 02:22 PM
Hello Hetal,

Please check the previous answers - the CSV export behavior is easily controllable - just check the  CSV Device Information Settings help article. In your particular case you have to use the NoHeader setting and set it to True.

All the best,
IvanY
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
A
Top achievements
Rank 1
answered on 26 Apr 2013, 08:36 AM
Hi,

I have the same issue. When setting the value of 'NoHeader' to true:
<Extensions>
      <Render>
        <Extension name="CSV" visible="true">
          <Parameters>
            <Parameter name="NoHeader" value="true"/>
          </Parameters
        </Extension>
      </Render>
    </Extensions>

I get no headers at all. How can i get the headers right?

 

 

 

0
IvanY
Telerik team
answered on 26 Apr 2013, 01:47 PM
Hello,

Perhaps you have set the NoStaticText option to true? This will hide any headers since they are static texts. Additionally please have in mind that in CSV the header of the column will be rendered for each record, at the most left part.

Greetings,
IvanY
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
A
Top achievements
Rank 1
answered on 29 Apr 2013, 09:35 AM
Hi,
I put the value of NoStaticText to true, but that does not help.
<Telerik.Reporting>
    <Extensions>
      <Render>
        <Extension name="CSV" visible="true">
          <Parameters>
            <Parameter name="NoHeader" value="false"/>
          <Parameter name="NoStaticText" value="true"/>
          </Parameters
        </Extension>
      </Render>
    </Extensions>
  </Telerik.Reporting>        
0
Chavdar
Telerik team
answered on 02 May 2013, 07:41 AM
Hi,

It is actually the opposite - setting NoStaticText to true will omit the headers since they are static text. That is why in the previous ticket we asked you if by accident you have set it to true.

Can you please prepare a screenshot of your report definition and a screenshot of the CSV exported. This will help us understand your issue better.

Greetings,
Chavdar
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Mae
Top achievements
Rank 1
answered on 09 Jul 2013, 11:38 AM
Hi,

I am creating a dynamic report based on a report template and the fields selected. When I export to csv, the first column has repeating data (of the first column).

Here's my web.config settings:
<configSections>
    <section name="Telerik.Reporting" type="Telerik.Reporting.Processing.Config.ReportingConfigurationSection, Telerik.Reporting, Version=7.0.13.426, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" allowLocation="true" allowDefinition="Everywhere"/>
  </configSections>

  <Telerik.Reporting>
    <Extensions>
      <Render>
        <Extension name="CSV">
          <Parameters>
            <Parameter name="NoHeader" value="false"/>
            <Parameter name="NoStaticText" value="true"/>
          </Parameters>
        </Extension>
      </Render>
    </Extensions>
  </Telerik.Reporting>

in the ReportTemplate.cs:
 private void table1_ItemDataBinding(object sender, EventArgs e)
        {
... //for loop - iterate all selected fields
   var textBox = new Telerik.Reporting.TextBox();
                            textBox.Name = colHeader;
                            textBox.Size = new SizeU(Unit.Inch(width), Unit.Inch(0.3));
                            textBox.CanGrow = true;
                            textBox.StyleName = "Data";
                            textBox.Value = "=Fields.[" + strColumn + "]";

...
         }

and lastly, please the attached file for the exported csv.

I don't experience this issue in static reports, I have placed this workaround inside the constructor:
       
       public Contracts()
        {
            InitializeComponent();

            this.textBox8.Name = "Contract Number";
            this.textBox9.Name = "Date Contract Received";
            this.textBox10.Name = "Deadline Date";
            this.textBox11.Name = "Date of Original Contract";
            this.textBox12.Name = "Contract Execution Date";
            this.textBox13.Name = "Contract Effective Date";
            this.textBox14.Name = "Contract Expiration Date";
            //this.table1.ItemDataBinding += new EventHandler(table1_ItemDataBinding);
        }

Hope you can help me ASAP. It will be greatly appreciated. 
0
Unknown
Top achievements
Rank 1
answered on 11 Jul 2013, 05:21 PM
You have to set NoHeader to true.
0
perry
Top achievements
Rank 1
answered on 25 Sep 2014, 06:04 PM
There root of the problem here is that instead of using the value contained in the textboxes in the CSV output on the heading line, the Textbox (Name) property "textbox1" is used.  I can think of no useful reason to export this value.  If the export would put the value of contained in the textbox (i.e. the actual column name) it would be useful and we could export the heading row.

I think this is a bug that is getting bypassed and ignored with instructions to set "NoHeader" = true in configuration.   Its a in my mind a bug that you cant set NoHeader=false and get a valid heading row.

Fix the problem!!  I need the heading rows!

0
Hinata
Top achievements
Rank 1
answered on 30 Sep 2014, 02:21 PM
Hi perry,

Given the above comments I believe this isn't a bug. It is the default behavior. Maybe you should send a feature request for a different behavior. You can even use the feedback portal.
0
Jack
Top achievements
Rank 1
answered on 22 Oct 2015, 04:23 PM

Perhaps this is the default behavior but... Is there a way to have the title of the header exported instead of the control name?

 

If the control title is "Last Name", I want to see that instead of "textbox1".

 

 

0
Stef
Telerik team
answered on 26 Oct 2015, 04:18 PM
Hi Jack,

Please test applying the CSV rendering settings for CSV Device Information Settings. The CSV rendering mechanism gets the report layout, iterates the processing elements and renders data in such manner, that it describes the report structure.

If you need to get only the data associated with report, my recommendation is to implement custom logic getting the data and storing it in the desired format.


We will appreciate it if you elaborate on the purpose of the exported CSV files and the requirements for the data format in the CSV file.

Regards,
Stef
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
Jack
Top achievements
Rank 1
answered on 27 Oct 2015, 07:50 PM
It appears you are still missing the point…

Yes I can set the NoHeader property to turn off headers.. but that is not what I am talking about. I want a header row with Header Title values…

Currently the way it works:

When the grid contents is saved to the csv file,

The first row has the name of the column controls….

TextBox1,TextBox2,TextBox3
John,Doe,12345
Sam,Smith,45678

The way I would like for it to work:

What I want is the Column Header titles….

FirstName,LastName,IdNumber
John,Doe,12345
Sam,Smith,12345
0
Stef
Telerik team
answered on 29 Oct 2015, 08:09 AM
Hi Jack,

The desired output is not describing the report layout, but rather the data schema. If you have a report as on the attached screenshot, the report layout will be described as follows:
titleTextBox    nameCaptionTextBox  groupNameCaptionTextBox departmentIDCaptionTextBox  nameDataTextBox groupNameDataTextBox    departmentIDDataTextBox
ReportHT    Name    Group Name  Department ID   Engineering Research and Development    1
ReportHT    Name    Group Name  Department ID   Tool Design Research and Development    2
ReportHT    Name    Group Name  Department ID   Sales   Sales and Marketing 3

Group information is repeated for each Detail row (the flatten representation of the items/sections hierarchy in the report).


Thus the solution is to work directly with the same data you are using for the report, read and store it in the required format.

Regards,
Stef
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
Jack
Top achievements
Rank 1
answered on 29 Oct 2015, 02:15 PM

I am not able to decipher what you are saying...

Can you explain it a little further because it does not seem to have any relevance to my last reply.

 

0
Stef
Telerik team
answered on 29 Oct 2015, 03:37 PM
Hello Jack,

Let assume you are creating a report with the data from AdventureWorks.HumanReasources.Department table. The data copied with headers from MSSQL Management Studio would look as on SQL.png:


Then to create the report you can use the Band Report Wizard, which will generate a static group section with headers and Detail section which displays the actual data. On preview you will get the result from ReportHR.png.

Then the CSV rendering mechanism works with the processing elements in the report, where data for items and what they display must be flatten. Thus any group sections' items and their content is repeated for each detail section's items and content. The result is CSV.png.


Having the above into account, you aim to get representation of the original data and its schema, not the report's layout. Thus you can directly get the data object, read its properties and store the actual values in a CSV file without using the reports CSV rendering mechanism.

Regards,
Stef
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
Madhu
Top achievements
Rank 1
answered on 14 Sep 2016, 06:06 AM

But what should we do when we want Headers as the same which we can see after running the report. I need the column header as it is which i can see after running the report.

It is strange that when i export to Excel all columns having proper header, but the same is not working for CSV, should it be this much complicated ?

0
Madhu
Top achievements
Rank 1
answered on 14 Sep 2016, 06:08 AM
This solution will not work when i need the column header as it is when i ran the report. I would like to have the column headers in CSV which can understand by users. thats how it should work when i set NoHeader = false

This is very strange that when i export to excel the column headers are working fine , but the same is not working when i export to CSV file ???
0
Madhu
Top achievements
Rank 1
answered on 14 Sep 2016, 06:09 AM
This solution will not work when i need the column header as it is when i ran the report. I would like to have the column headers in CSV which can understand by users. thats how it should work when i set NoHeader = false

This is very strange that when i export to excel the column headers are working fine , but the same is not working when i export to CSV file ???
0
Stef
Telerik team
answered on 14 Sep 2016, 09:37 AM
Hello Madhu,

Please check my last post in Report export to CSV has extra columns.

I will appreciate if we continue the discussion in one of the threads in order to keep a better track on the exchanged information.
Thank you for your understanding.

Regards,
Stef
Telerik by Progress
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
Stuart
Top achievements
Rank 1
answered on 31 Oct 2016, 10:57 AM

Under the understanding that CSV column headers can be turned off via webconfig update with the following:

  <configSections>
    <section name="Telerik.Reporting" type="Telerik.Reporting.Processing.Config.ReportingConfigurationSection, Telerik.Reporting, Version=9.1.15.624, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" allowLocation="true" allowDefinition="Everywhere"/>
  </configSections>

  <Telerik.Reporting>
    <Extensions>
      <Render>
        <Extension name="CSV">
          <Parameters>
            <Parameter name="NoHeader" value="true"/>
          </Parameters>
        </Extension>
      </Render>
    </Extensions>
  </Telerik.Reporting>

How can this be achieved programmatically?  as our clients would like some csv reports with headers, and some without... So we could do with the ability to switch this programmatically rather than manually editing their configs each time...

Is there a way to do this via code?

 

0
Stef
Telerik team
answered on 31 Oct 2016, 12:17 PM
Hello Stuart,

You can hide the CSV export option and export programmatically, where you can pass the NoHeader parameter's value at run-time:

Regards,
Stef
Telerik by Progress
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
1
Steve
Top achievements
Rank 1
answered on 03 Nov 2017, 12:30 PM

This has to be the worst solution I have ever heard. 

Why not make the CSV export do what the entire world would expect it to do?  Why would I want a user to view the report but not click the export button?  Am I missing something?

 

0
Katia
Telerik team
answered on 08 Nov 2017, 08:21 AM
Hello Steve,

Solutions offered by Stef in this post are suitable when someone wish to change the settings of CSV rendering extension at run-time, see an earlier post from Stuart. More straightforward approach for hiding header information from the CSV output is with NoHeader parameter set in <extensions> element of Telerik.Reporting configuration section in application configuration file.
More details can be found in the following help articles:

Regards,
Katia
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
Steve
Top achievements
Rank 1
answered on 08 Nov 2017, 12:20 PM

Katia,

I WANT the headers.  The actual headers in the report.  NOT Textbox1, Textbox2, etc.

Every user that exports to CSV would expect to see the data that way.

Can it do this?

 

Steve

 

0
Katia
Telerik team
answered on 13 Nov 2017, 08:39 AM
Hello Steve,

The first record will contain the headers for all the columns in the report where the header is the item's name (textBox1, textBox2 etc.) not value - Design Considerations for CSV Rendering. To export the headers with actual column names you need to rename the items, for example set TextBox.Name property to ColumnName1 instead of the default textBox1.


Regards,
Katia
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
Jacob
Top achievements
Rank 1
answered on 09 May 2018, 09:29 PM

Good to know that this is the only way to change the column headers (save for removing them and ignoring static ones).

What would be your recommendation then for Localizing the headers?  Do I need to resort to the source, and if so could I get a little guidance as to which part of the source?

0
Katia
Telerik team
answered on 14 May 2018, 10:00 AM
Hello Jacob,

The approach for localizing reports is similar to the one Visual Studio provides for Windows Forms. Visual Studio report designer lets you define static text for the report in each language that you specify. A resource file (resx) is automatically created for each language to store translated text.
For the detailed steps on how to localize the report and display it in the application check Localizing Reports help article.

Standalone report designer does not support the same approach for localizing reports. In Standalone designer you can use a user function that gets the value from the resource file, for example using ResourceManager.GetString Method. User functions can be used in expressions when setting the values of report properties.


Regards,
Katia
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
Franklin
Top achievements
Rank 1
answered on 19 Mar 2019, 01:36 PM
This is till a problem with 2018 R3 and the "solutions" offered here are garbage.
0
Richard
Top achievements
Rank 1
answered on 21 Mar 2019, 05:39 PM

[quote]This is till a problem with 2018 R3 and the "solutions" offered here are garbage.[/quote]

Just ran into this and agree, why in the world would the Excel export work with the header text while the CSV outputs the header textbox names? They are essentially the same, minus the formatting. Don't see any reason why they couldn't export the value.

0
Silviya
Telerik team
answered on 22 Mar 2019, 11:26 AM
Hi Franklin and Richard,

I'm sorry to hear that you have faced negative experience with our CSV Rendering mechanism. May I ask you what is your current report layout? As the CSV rendering is best suited for reports with one flat data item.

The CSV rendering extension is designed to unfold the representation of a report data in a plain-text format, as explained in Design Considerations for CSV Rendering. The header texts are the Name-s of the data bound text boxes. You can change their names to match your preferences.
In order to keep the grouping and preserve the report layout please consider exporting to Excel format instead. 

Best Regards,
Silviya
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
Sukumar
Top achievements
Rank 1
answered on 09 Apr 2019, 09:37 AM

Hi,
I am using telerik report viewer in angularJS. When I export report to CSV, the header contains wiered things like textbox1, textbox2,.... After following up the above conversation I get know that the change is to be made in telerik reporting xml configuration like this

<Extensions>
      <Render>
        <Extension name="CSV" visible="true">
          <Parameters>
            <Parameter name="NoHeader" value="true"/>
          </Parameters> 
        </Extension>
      </Render>
    </Extensions>

But I cannot change the settings as telerik is referenced from nuget package manager in my project. When I hit a prod build, each time updated telerikReporting configuration is fetched from Nuget.

Can you please help me with a way how to change CSV rendering options in another way like doing it programatically without changing XML configuration.

Thanks in advance
Sukumar.

Tags
General Discussions
Asked by
Nisha
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Nisha
Top achievements
Rank 1
Hetal
Top achievements
Rank 1
A
Top achievements
Rank 1
Chavdar
Telerik team
Mae
Top achievements
Rank 1
Unknown
Top achievements
Rank 1
perry
Top achievements
Rank 1
Hinata
Top achievements
Rank 1
Jack
Top achievements
Rank 1
Stef
Telerik team
Madhu
Top achievements
Rank 1
Stuart
Top achievements
Rank 1
Steve
Top achievements
Rank 1
Katia
Telerik team
Jacob
Top achievements
Rank 1
Franklin
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Silviya
Telerik team
Sukumar
Top achievements
Rank 1
Share this question
or