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

CSV custom output

4 Answers 611 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 21 Nov 2019, 03:26 PM

Hello,

as usually I have a table in my report.

In this case it is a table who shows travelling expenses.

And now I want to export the table datas in a csv file.

But the output is not that what I want.

Please see the attached file!

It is a jumble of datas with Layout information textBox1,textBox3,textBox2, and so on.

The column headings should appear only in the first line of the csv file.

I also have some textboxes with content Format("created on: {0:dd/MMM/yyyy HH:mm} ", Now()) and  "Reisekosten Report" in the report header, which should not appear in the csv file.

To make it short: How can I influence the output?

 

Best regards

Simon

 

4 Answers, 1 is accepted

Sort by
0
Simon
Top achievements
Rank 1
answered on 26 Nov 2019, 09:53 AM

UPDATE:

With the help of this site, all these Layoutinformation in the csv file I got it off.

https://docs.telerik.com/reporting/device-information-settings-csv?_ga=2.143424949.1850321217.1574669102-771678943.1574408885

But it is still not the desired result.

The column header should only be displayed in the first row of the csv file.

And then in the other rows the content.

But what I now have in the csv file is from structure: column header, content, column header, content, column header,content (in one row)

How can I solve this issue?

Best regards

Simon

 

 

 

0
Todor
Telerik team
answered on 26 Nov 2019, 11:58 AM

Hello Simon,

The observed behavior is by design, e.g. the Table will be flattened and the name of the column with its value will be displayed for each table row. You may turn off the static headers by setting NoStaticText to true in the configuration file as explained in the referred article. The headers (if static) will not be shown in the first row though. For more information on the CSV format, you may check the Design Considerations for CSV Rendering article.

If you use some of our viewers, you may handle the ExportEnd event, where to get the document and modify it as required. For example, for the Html5 Report Viewer the exportEnd(e, args) args.url contains the URL of the exported report as a resource. You may get it and add the table columns names.

Regards,


Todor
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
Simon
Top achievements
Rank 1
answered on 27 Nov 2019, 01:02 PM

Hi,

Ok, I have managed it.

In my project I have more than one report - at least 4 reports.

I have learned that I can make some settings in the app.config.

<Telerik.Reporting>
 
  <Extensions >
    <Render>
      <Extension name="IMAGE" visible="false">
      </Extension>
      <Extension name="XPS" visible="false">
      </Extension>
      <Extension name="MHTML" visible="false">
      </Extension>
      <Extension name="XLS" visible="true">
      </Extension>
      <Extension name="CSV" visible="true">
        <Parameters>
          <Parameter name="NoHeader" value="false"/>
          <Parameter name="NoStaticText" value="true"/>
          <!--<Parameter name="FieldDelimiter" value=", "/>-->           
        </Parameters>
      </Extension>
      <Extension name="RTF" visible="false">
      </Extension>
      <Extension name="PDF" visible="true">
        <Parameters>
          <Parameter name="DocumentAuthor" value="TMS" />
        </Parameters>
      </Extension>
    </Render>
  </Extensions>
 
</Telerik.Reporting>

 

These settings are valid in the same way for all reports.

Now, how can I make special settings for one report.

What I mean is: In one report CSV is visible and in another report not.

Is it possible to distinguish the reports in the app.config file?

 

Best regards

Simon

0
Todor
Telerik team
answered on 02 Dec 2019, 09:31 AM

Hi Simon,

The application settings in the configuration file will be applied to the entire application, including all viewers and it is not possible to specify reports that can be exported in CSV and others that cannot.

As a workaround, you may use a custom UI for export and handle the export with custom code, e.g. using the Report Processor class.

Note that you may customize the report based on the export format - check the RenderingFormat Global Object.

Regards,
Todor
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
Tags
General Discussions
Asked by
Simon
Top achievements
Rank 1
Answers by
Simon
Top achievements
Rank 1
Todor
Telerik team
Share this question
or