change text export file encoding?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MattG
Newbie
Newbie
Posts: 23
Joined: Thu Jun 27, 2013 12:00 am

change text export file encoding?

Post by MattG » Thu Oct 31, 2013 2:51 am

When I export a text file, it is encoded as UCS-2 Little Endian. Can I change this? I'd like to encode it as UTF-8.

A little background: I'm exporting comma-delimited text files with the extension csv. I'd like to be able to double-click them in Windows and have Excel open them correctly, but everything goes into column A if the file is UCS-2 Little Endian. If converted to UTF-8 it works fine.

Yes, I'm aware that I can export in Excel format (actually HTML...) and get to Excel that way. I also need csv files that work.

Thank you,
Matt Garrett
CRTech
Boulder, Colorado, USA

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: change text export file encoding?

Post by Sandra » Thu Oct 31, 2013 5:07 pm

Hello MattG,

Thank you for the observation. We can't offer the encoding that you request straight-off as an external variation as the principal method called internally is not publicly visible, but the request is worthwhile us adding as a new feature, to be able to choose the encoding type, so we'll add that for the next version.

As a variation, an interim workaround, a csv delimiter that is likely to work as you require, opening various data columns separately from the csv in Excel would be the default tab character.

eg.

Code: Select all

      tChart1.Export.Data.Text.TextDelimiter = "\t";   
      tChart1.Export.Data.Text.Save(@"c:\datafiles\excelchart.csv");
Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: change text export file encoding?

Post by Sandra » Tue Nov 05, 2013 9:57 am

Hello MattG,

I inform you that we understand that may not fit well with other requirements you have for the files so we'll alrady get on and make the change suggested, in Feature request. As you see we fixed it and for next version of TeeChartfor.Net you can export DataFormat with optional encoding if you want. I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MattG
Newbie
Newbie
Posts: 23
Joined: Thu Jun 27, 2013 12:00 am

Re: change text export file encoding?

Post by MattG » Sat Jan 04, 2014 12:10 am

Hi Sandra,

Yes, that worked. Thank you. I used TeeChart for .NET 4.1.2013.11080 and the following C++/CLI code:

Code: Select all

using namespace Steema::TeeChart;
using namespace System::IO;

	Export::DataExport ^SteemaDe = gcnew Export::DataExport(tchart->Chart);
	SteemaDe->Text->TextDelimiter = ",";
	SteemaDe->Text->TextLineSeparator = "\r\n";   // Windows
	FileStream ^out = gcnew FileStream(fn, FileMode::Create);
	SteemaDe->Text->Save(out, System::Text::Encoding::UTF8);
	out->Close();
Matt Garrett
CRTech
Boulder, Colorado, USA

Post Reply