SSRS 2008 Column issue when exporting to a CSV file
Hello I have built an SSRS 2008 report that I will be exporting the data into a CSV file everytime the report is run. The problem that I am having is that the fields in the CSV file have to be in a particular way because the CSV file will imported into another web application system. In my query my fields are set as illustrted below: [Phone #] [Mobile #] [Street Address] [Other Name(s)] However when I export the data into a CSV file it sets it as this: Phone__ Mobile__ Street__Address Other_Name_s_ I need the columns when exported to a CSV file to display as follows: Phone # Mobile # Street Address Other Name(s) Does anyone know how to resolve this issue with SSRS 2008?Kajoo
November 10th, 2009 1:39pm

Hello Kajoo,UniCode and ASCII conversation issue, Could be, please have a lookhttp://behindthecode.net/Blog/post/2008/01/29/How-to-modify-Reporting-Services-CSV-export-Behavior.aspxThanks
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2009 4:27pm

Under the this code:<Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering"/> I added the following to the rsreportserver.config under the <DeviceInfo> <NoHeader>true</NoHeader> <Encoding>ASCII</Encoding> </DeviceInfo> But it did not solve the problem. When I export to a csv file the columns are still there and are in the same format as they were before.Thanks Kajoo
November 12th, 2009 12:35pm

Is there a way to set up the properties to use the Text box as the header when exporting to a CSV file?Kajoo
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2009 1:13pm

.Hi Ke Yu and everyone else reading this thread. I have been searching for 2 days now trying to find a solution to my problem with column header rendering in CSV when exporting a SSRS 2008 report to CSV format but I have not found a solution that works for me. Everything I tried has absolutely no effect on the output or the effect is not what I need. I tried setting the DataElementName and DataElementOutput properties to get the headers to show as they should, but it does not work for me. I either get no chance at all, or I end up with additional columns in the exported file with the DataElementName as the header for the new column and as the value in every row. Here is what my report looks like in Excel, HTML or any other format available in SSRS, except CSV of course. Customer ID Customer Name State City Sales Territory Sales Region Expiration Point Balance 156280 First Customer Name NE OMAHA 34 HL 0 468672 Second Customer Name CO DENVER 44 W 0 And this is what it looks like in CSV: Textbox18 Textbox16 Textbox14 Textbox12 SalesTerritory SalesRegion ExpirationPointBalance 156280 First Customer Name NE OMAHA 34 HL 0 468672 Second Customer Name CO DENVER 44 W 0 All the columns are in the details group, there are no sorts or hidden fields or dynamic headers. It is really as simple as it looks: A list of customers, some info about each customer and a point balance. This report is about as simple as it can be. I see no reason to have a details group and neither created it no did I place any columns in the details group but SSRS seems to need it. I tried removing the group but the output was incorrect when I did that. The report contained only 1 row when I remove the detail group (Selecting the "Remove Group Only" option). I was surprised by that. It seems the details group is required, though I don't see why it should be. The query I use to get the data does not group the data either, but it includes an "Order By" clause. I already mentioned that my DataElementNames are set for all column headers. I entered the same values I used on the Textbox but removed any spaces and I had to shorten the ExpirationPointBalance name to PointBalance because the DataElementName property would not allow me to enter the full name. I suspect the string is too long. When I change the DataElementOutput property for all the columns to "OutPut", the report looks like this when exported to CSV: CustomerID CustomerName State City Territory Region PointBalance Textbox18 Textbox16 Textbox14 Textbox12 SalesTerritory SalesRegion ExpirationPointBalance Customer ID Customer Name State City Territory Region Expiration Point Balance 156280 name 1 NE OMAHA 34 HL 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 468672 Name 2 CO DENVER 44 W 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 519729 Name 3 NJ ENGLISHTOWN 11 NE 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 526863 Name 4 NC CHARLOTTE 25 SE 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 670896 Name 5 AZ GLENDALE 46 W 25 Customer ID Customer Name State City Territory Region Expiration Point Balance 472014 Name 6 NY ORCHARD PARK 12 NE 50 Customer ID Customer Name State City Territory Region Expiration Point Balance 16061 Name 7 NY BROOKLYN 5 NE 0 I hope that looks ok when it is posted. The lines are very long and they may wrap. The important thing about the sample output is in the first 7 columns though so I am hoping you can still see what happens when I set DataElementOutput to OutPut and enter a value for DataElementName. Please note that I changed the values in the Customer Name column for each sample to protect the privacy of our customers and I had to change the spacing between some columns so the values line up with the headers but I made no other changes. This is the exact output as it appears in each version of the report. The only suggestion I have not tried is to set the NoHeader option to True in the SSRS configuration file, because the people who will use this report would rather have the weird headers than none at all. So changing the config file to skip the headers is not an option. I have tried every other option to fix this I have been able to find. As far as I know, this is the only report that shows this problem when exported to CSV but that could be because CSV export is not used by many people here. Most export to Excel. Do you have any suggestions for fixing this? I am at a loss. I have tried everything I could find that did not require changes to the config file but nothing works! Any and all ideas would be greatly appreciated. Thanks for reading. URW PS: After I submitted I saw that the report samples lines did indeed wrap as I feared, making the sample difficult to read. I don't know what to do about it though. The only thing I can think of is to copy the samples and paste them into a text file or a Word document and then edit the rows so they fit a single row. I used the Insert Code Block option to insert the samples. If you have a better idea or suggestions to fix the way the report samples are displayed, I'd love to hear it.
March 31st, 2011 12:48pm

I changed the textbox name and the DataElementName to the column headings that I wanted. Then I changed DataElementOuput to ouput. This got rid of the extraneous column names. It worked for both csv and xml. I am using version 2008
Free Windows Admin Tool Kit Click here and download it now
April 24th, 2012 10:32am

What if we are using expressions to display the column name which will change dynamically at run time?? Example: I have a column "Division" (which is coming from other data source say "Label") and result set for that Division is coming from mail report source say"Recordset". Now when I run the report it gives the result as below: Division ----------------- DISTRIBUTION CENTER NORTHERN DIVISION NORTHERN DIVISION NORTHERN DIVISION NORTHERN DIVISION NORTHERN DIVISION But when I export this report to CSV I am getting the result as below. Textbox1 L2_Name Division DISTRIBUTION CENTER Division NORTHERN DIVISION Division NORTHERN DIVISION Division NORTHERN DIVISION Division NORTHERN DIVISION Division NORTHERN DIVISION Can you please help me resolving this issue to remove the extra column textbox1 with repeating Division values. It should show as the same as report above. Thanks in advance for your help. -Ramesh Ramesh
May 25th, 2012 4:01am

Sorry for bumping, but I am wondering if there is any workaround/solution to this. I can export to excel with the column headings having the proper spaces. But in csv format they become underscores. Thanks Kafarabo
Free Windows Admin Tool Kit Click here and download it now
August 28th, 2012 6:36pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics