Page 1 of 2

Tag property & export to CSV

Posted: Fri Apr 08, 2016 2:49 pm
by NicolasM
Hello,

I started to use StimulSoft few weeks ago, with C# and BO.

Now I try to generate an export to CSV format. But I have a problem: when the file was generated, the first line contains: "Table_Cell5,Table_Cell6,Table_Cell7,Table_Cell8" and not my header (create with anothers Table_Cell).

So how can I have the header into the first line of my CSV file ?

I found this: http://forum.stimulsoft.com/viewtopic.php?t=649
But here, the Tag property is used and I don't know how to change it with the Designer. Can you explain me how to do, please ?

Thanks in advance for your help !

Re: Tag property & export to CSV

Posted: Sun Apr 10, 2016 10:52 pm
by Ivan
Hello,

By default in Csv, Dbf and Xml exports only textboxes from DataBand are exported ("only data"). The default name of column corresponds to the name of the textbox.
If you want another name of column, you should rename textbox or write in the Tag property of textbox the following expression:

Code: Select all

CSV: "NameCsv"; DBF: "NameDBF"; XML: "NameXml"; Default: "NameDefaultForCsvAndDbfAndXml"; 
Please check the screenshot in attachment for information how to set the Tag property of the component.

If you use the version 2015.2 or later, you also can do the following workaround:
In the export settings menu you can set the "Bands Filter" property to the "Data and Headers/Footers", and check the "Skip Column Headers" option.
Now text from header will be exported as column headers.

Thank you.

Re: Tag property & export to CSV

Posted: Mon Apr 11, 2016 8:55 am
by NicolasM
Hello Ivan,

Thanks a lot for your help !

I cannot use the second method beacause I use the 2014 3.0 version. But the first method works fine ! Thanks to show me where I can edit Tag property, it's very useful.

During testing, I found a problem with this method: Report.ExportDocument(StiCsvExportService, string)
When I try to use this method, I have an exception: The incorrect type of the settings argument is used. The StiCsvExportSettings is need to be used.

Is it a bug ? Or I don't well using this methods ?

Code: Select all

Stimulsoft.Report.StiReport report = this.stiDesignerControl.Report;
report.Render(true);

// Get filepath
string filepath = GetFilePath("CSV File|*.csv");

// Export document
StiCsvExportService service = new StiCsvExportService();
report.ExportDocument(service, filepath);

// Open document
System.Diagnostics.Process.Start(filepath);
Thanks again for your help.

Re: Tag property & export to CSV

Posted: Mon Apr 11, 2016 1:10 pm
by Alex K.
Hello,

Please try to check the last build and let us know about the result.

Thank you.

Re: Tag property & export to CSV

Posted: Mon Apr 11, 2016 1:51 pm
by NicolasM
Hello Aleksey,

Thank you for your reply. Unfortunately, I think I just have a licence, not a subscription.

Thanks.

Re: Tag property & export to CSV

Posted: Tue Apr 12, 2016 9:18 am
by Ivan
Hello,

Please try to modify your code:

Code: Select all

// Export document
StiCsvExportSettings settings = new StiCsvExportSettings();
rep.ExportDocument(StiExportFormat.Csv, filepath, settings);
Thank you.

Re: Tag property & export to CSV

Posted: Tue Apr 19, 2016 9:44 am
by NicolasM
Hello Ivan,

Thanks for your reply.

Your code works but user cannot edit setting like with StiCsvExportService. Or I can use StiCsvExportService bialog box to get a StiCsvExportSettings?

Thanks for your help (and sorry for this later answer).

Re: Tag property & export to CSV

Posted: Wed Apr 20, 2016 9:32 am
by HighAley
Hello.

Yes, please, try to use next code to export the report:

Code: Select all

StiCsvExportService service = new StiCsvExportService();
service .Export(report, filepath);
Thank you.

Re: Tag property & export to CSV

Posted: Wed Apr 20, 2016 1:41 pm
by NicolasM
Hello HighAley,

Thanks for your help.

Unfortunately I have the same error with this code: The incorrect type of the 'settings' argument is used. The StiCsvExportSettings is need to be used.

Re: Tag property & export to CSV

Posted: Thu Apr 21, 2016 11:05 am
by Alex K.
Hello,

The issue is fixed in the last build. Please try to check the build 2016.1.8 from 2016.04.15.

Thank you.