csv export

Stimulsoft Reports.Flex discussion
Locked
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

csv export

Post by Chipo »

G'day,

How can I set default separator and "Skip Column Headers" option during runtime for "Export To CSV" feature?

Best regards.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: csv export

Post by Vladimir »

Hello,

You can use this code:

Code: Select all

viewer.addEventListener(StiViewerEvent.START_EXPORT, onStartExport);
...

private function onStartExport(event: StiViewerEvent): void
{
    if (event.exportSettings.exportFormat == StiExportFormat.Csv)
    {
        StiCsvExportSettings(event.exportSettings).separator = ",";
        StiCsvExportSettings(event.exportSettings).skipColumnHeaders = true;
    }
}
Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: csv export

Post by Chipo »

Thank you. Works like magic.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: csv export

Post by Vladimir »

Hello,

We always glad to help you!

Thank you.
S.B.
Posts: 2
Joined: Fri Jun 26, 2015 10:00 am

Re: csv export

Post by S.B. »

Hi!
Tell me please, how could I set StiCsvExportSettings (for example SkipColumnHeaders = true) in a Designer (in mrt file)?
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: csv export

Post by Vladimir »

Hello,

You can use this code:

Code: Select all

designer.previewControl.addEventListener(StiViewerEvent.START_EXPORT, onStartExport);
...

private function onStartExport(event: StiViewerEvent): void
{
    if (event.exportSettings.exportFormat == StiExportFormat.Csv)
    {
        StiCsvExportSettings(event.exportSettings).skipColumnHeaders = true;
    }
}
This should work for the preview of the report in the report designer.

Thank you.
S.B.
Posts: 2
Joined: Fri Jun 26, 2015 10:00 am

Re: csv export

Post by S.B. »

Thank you!
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: csv export

Post by HighAley »

Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Locked