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

CSV Export Column Headers

5 Answers 254 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephen McDaniel
Top achievements
Rank 1
Stephen McDaniel asked on 30 Dec 2008, 01:20 AM
I know that when you export to CSV, the Column Headers are just the "Names" of the text box.  I want to have descriptive Column Headers, but since the name is can't have spaces, special characters, etc., I'm pretty limited. 

I'm wondering if there is any other way of specifing Column Headings that would allow me more flexibility? 

It would be great if you could add a property to TextBox that is the text to use for that TextBox's Column Header if it is exported to CSV.  I know that might be a lot to go through for just one Export Format and for just one improvement, but I can't think of any other way to have good Column Headers that aren't tied to the name of the textbox in code.

Any help would be appreciated.

Thanks,
-Stephen

5 Answers, 1 is accepted

Sort by
0
Accepted
Hrisi
Telerik team
answered on 30 Dec 2008, 10:20 AM
Hi Stephen McDaniel,

The limitations about report items names are only in design-time. If you want to change names of the textboxes you can do it in the default constructor of the report after InitializeComponent() call. Attached you can find an example report.

Kind regards,
Hrisi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Roland
Top achievements
Rank 1
answered on 07 Nov 2012, 08:15 AM
Hello

I've tried to rename the textboxes in codebehind as in the solution, but it does not work correctly for me in 6.1.12.820.
As the screenshots show I get the renamed textboxes, but all the rows under them are empty and the columns with data come after the header fields.

I have also tried a horizontal table as a header, and taking a List<string> as a datasource, but the cells were just called "textBox1"...

Is there any way to achieve proper column headers for CSV output?

Help would be much appreciated.

Roland
0
Steve
Telerik team
answered on 09 Nov 2012, 10:19 AM
Hello Roland,

It would be best if you could provide us with more details about your report layout or better yet provide a sample report that you want to export to CSV and once we review it, we would advise you accordingly.

On a side note, if your only requirement is to export your data to csv, you can save the contents of your database to a csv file manually (i.e. without the need for reporting) according to your needs. Here are some threads that might get you started e.g.:
  1. Saving a DataTable to a CSV file 
  2. Export CSV from Dataset
  3. Save text from database to text file

All the best,
Steve
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
Roland
Top achievements
Rank 1
answered on 09 Nov 2012, 01:04 PM
Hi Steve

I get data from EntityFramework and need to process it before generating the CSV.

The data is in a table, where I would need to add the header fields. I put together a small project, but can't upload it here.
Could you please advise how to proceed with this case?

Best regards,
Roland
0
Steve
Telerik team
answered on 14 Nov 2012, 09:47 AM
Hi Roland,

In order to attach a project you should open a support ticket. Forums allow only image attachments in order to prevent unwanted distribution of our product to the public.

Regards,
Steve
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!

Tags
General Discussions
Asked by
Stephen McDaniel
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Roland
Top achievements
Rank 1
Steve
Telerik team
Share this question
or