Page 1 of 1

change text export file encoding?

Posted: Thu Oct 31, 2013 2:51 am
by 15666411
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,

Re: change text export file encoding?

Posted: Thu Oct 31, 2013 5:07 pm
by 10050769
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,

Re: change text export file encoding?

Posted: Tue Nov 05, 2013 9:57 am
by 10050769
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,

Re: change text export file encoding?

Posted: Sat Jan 04, 2014 12:10 am
by 15666411
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();