This project has moved. For the latest updates, please go here.

Exporting to Comma Delimeted Format

Apr 11, 2011 at 4:30 PM

First I want to say thank you for DoodleReport. It's really easy to use and very extensible.
The question I have is how to export in Comma Delimited format. The DelimitedTextReportWriter defaults to using Tabs, and I cannot seem to find the property to specify what delimeter to use.

Please let me know how I can achieve this.
Thanks,
Carlos P.

Coordinator
Apr 11, 2011 at 4:39 PM
Edited Apr 11, 2011 at 4:40 PM

Hi Carlos,

There are 2 ways to solve this.

1) If you want to change the default to always use a comma (or any other delimiter), then you can set the static property on DelimitedTextReportWriter. Unfortunately this is not a web.config configurable element right now, so you will need to set the property somewhere in your Application_Start logic in Global.asax.

public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        DelimitedTextReportWriter.DefaultDelimiter = DelimitedTextReportWriter.CommaDelimiter;
    }
}

2) If you want to customize the delimiter for a specific report, you can pass in a custom RenderHint to the report

myReport.RenderHints[DelimitedTextReportProvider.DelimiterHint] = DelimitedTextReportWriter.CommaDelimiter;

BTW, you can use any string you want for the delimiter in both cases -- I simply chose to use the CommaDelimiter const property in this sample code.

Hope that helps

-Matt

Apr 11, 2011 at 6:05 PM
Thank you very much Matt. That worked perfectly.

report.RenderHints[DelimitedTextReportWriter.DelimiterHint] = DelimitedTextReportWriter.CommaDelimiter;