get rid of comma thousands separator in export
get rid of comma thousands separator in export
When I export a chart to a text file, the exporter inserts commas to separate thousands, e.g., "1,234" instead of "1234". This causes problems for parsing the resultant file, and makes comma-delimited files completely useless. How do I get rid of the thousands separator, or more generally, control the number format of the exported text?
Matt Garrett
CRTech
Boulder, Colorado, USA
CRTech
Boulder, Colorado, USA
Re: get rid of comma thousands separator in export
Hello MattG,
The format of digits of text exportation of TeeChart is the same you have for your computer defined in Region and Language, for this reason, if you doesn't want the thousands are separate commas please change this configuration. To change the configuration please folow next steps:
1.- Going to Control Panel\All Control Panel Items\Region and Language
2.- In first tab, select additional settings.
3.- Change the options as you want.
I hope will helps.
Thanks,
The format of digits of text exportation of TeeChart is the same you have for your computer defined in Region and Language, for this reason, if you doesn't want the thousands are separate commas please change this configuration. To change the configuration please folow next steps:
1.- Going to Control Panel\All Control Panel Items\Region and Language
2.- In first tab, select additional settings.
3.- Change the options as you want.
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: get rid of comma thousands separator in export
Thank you Sandra. It's too bad I can't override the Region and Language settings for TChart export. It's not ideal to have to tell my users to change that setting in order to achieve non-corrupted csv files.
But thanks for the quick response!
But thanks for the quick response!
Matt Garrett
CRTech
Boulder, Colorado, USA
CRTech
Boulder, Colorado, USA
Re: get rid of comma thousands separator in export
Hello MattG,
You can find an alternative using the Globalizing and Localizing Applications class and try to use the FormatNumber or InvariantCulture. I think these can help you to solve your problem without changing the Region and Language properties. See next link example as apply it in Text Files:
http://msdn.microsoft.com/en-us/library ... s.90).aspx
If it doesn't help you please, let me know and we try to find a concretely solution.
Thanks,
You can find an alternative using the Globalizing and Localizing Applications class and try to use the FormatNumber or InvariantCulture. I think these can help you to solve your problem without changing the Region and Language properties. See next link example as apply it in Text Files:
http://msdn.microsoft.com/en-us/library ... s.90).aspx
If it doesn't help you please, let me know and we try to find a concretely solution.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: get rid of comma thousands separator in export
Hi Sandra,
I haven't had a chance yet to try FormatNumber or InvariantCulture. Instead, I was looking at another piece of legacy code I maintain; this one references TeeChart v4.0.2010 for .NET 2.0. Unfortunately, it does not seem to check the Region and Language Settings and instead always outputs numbers with commas as thousands separators. Is there something else I can try with that old version? I'd like to avoid updating the references in this legacy code.
Thanks,
I haven't had a chance yet to try FormatNumber or InvariantCulture. Instead, I was looking at another piece of legacy code I maintain; this one references TeeChart v4.0.2010 for .NET 2.0. Unfortunately, it does not seem to check the Region and Language Settings and instead always outputs numbers with commas as thousands separators. Is there something else I can try with that old version? I'd like to avoid updating the references in this legacy code.
Thanks,
Matt Garrett
CRTech
Boulder, Colorado, USA
CRTech
Boulder, Colorado, USA
Re: get rid of comma thousands separator in export
Okay, I just updated to TeeChart 4.1.2013.5280 for .NET2.0 in the legacy .NET3.5 project, so now I'm using 4.1.2013.528x for a .NET4.0 project and for the .NET3.5 project.
The .NET4.0 program uses the regional settings as described, but the .NET3.5 program still does not, i.e., I'm still seeing commas as thousands separators in the old .NET3.5 program, despite using the same version TeeChart as the .NET4.0 program, for which I was able to remove the commas. Help!
Thank you,
The .NET4.0 program uses the regional settings as described, but the .NET3.5 program still does not, i.e., I'm still seeing commas as thousands separators in the old .NET3.5 program, despite using the same version TeeChart as the .NET4.0 program, for which I was able to remove the commas. Help!
Thank you,
Matt Garrett
CRTech
Boulder, Colorado, USA
CRTech
Boulder, Colorado, USA
Re: get rid of comma thousands separator in export
Hello MattG,
Sorry for the delay. I haven't forgotten your problem, we are working to suggest an answer asap.
Thanks,
Sorry for the delay. I haven't forgotten your problem, we are working to suggest an answer asap.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: get rid of comma thousands separator in export
Hello MattG,
Sorry for the delay. If you change the ValueFormat of your series values and you combine it with CultureInfo.InvariantCulture, the format you get in the exportation is the format you expect, without make changes in the computers of your user Please, see next code:
With .Net Framework 4.0 or 4.5
With .Net Framework 3.5:
Could you tell us if my suggestion, works for you?
Thanks,
Sorry for the delay. If you change the ValueFormat of your series values and you combine it with CultureInfo.InvariantCulture, the format you get in the exportation is the format you expect, without make changes in the computers of your user Please, see next code:
With .Net Framework 4.0 or 4.5
Code: Select all
public Form1()
{
InitializeComponent();
tChart1 = new TChart();
//tChart2 = new TChart();
this.Controls.Add(tChart1);
//this.Controls.Add(tChart2);
tChart1.Dock = DockStyle.Top;
//tChart2.Dock = DockStyle.Bottom;
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line series1 = new Line(tChart1.Chart);
series1.FillSampleValues(1000);
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
tChart1[0].ValueFormat = "##";
series1.XValues.Name = "TIME";
series1.YValues.Name = "MAIN.T3";
tChart1.Draw();
tChart1.Export.Data.Text.IncludeHeader = true;
tChart1.Export.Data.Text.IncludeIndex = true;
tChart1.Export.Data.Text.IndexFieldName = series1.XValues.Name;
tChart1.Export.Data.Text.Save(@"C:\testChart.txt");
}
Code: Select all
public Form1()
{
InitializeComponent();
tChart1 = new TChart();
tChart2 = new TChart();
this.Controls.Add(tChart1);
this.Controls.Add(tChart2);
tChart1.Dock = DockStyle.Top;
tChart2.Dock = DockStyle.Bottom;
TestVersion3.Properties.Resources.Culture = CultureInfo.InvariantCulture;
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line series1 = new Line(tChart1.Chart);
series1.FillSampleValues(1000);
tChart1[0].ValueFormat = "##";
series1.XValues.Name = "TIME";
series1.YValues.Name = "MAIN.T3";
tChart1.Draw();
tChart1.Export.Data.Text.IncludeHeader = true;
tChart1.Export.Data.Text.IncludeIndex = true;
tChart1.Export.Data.Text.IndexFieldName = series1.XValues.Name;
tChart1.Export.Data.Text.Save(@"C:\testChart3.5.txt");
}
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: get rid of comma thousands separator in export
Hi Sandra,
Thank you for the example code.
I was able to control the export format using:
Thanks,
Matt
Thank you for the example code.
I was able to control the export format using:
Code: Select all
tChart1[i]->ValueFormat = MyFormatString;
Matt
Matt Garrett
CRTech
Boulder, Colorado, USA
CRTech
Boulder, Colorado, USA