export datetime data to excel

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
alinak74
Newbie
Newbie
Posts: 4
Joined: Tue Feb 01, 2011 12:00 am

export datetime data to excel

Post by alinak74 » Wed Apr 27, 2011 9:41 am

Hello,

We have a date time values on the bottom axis. Export to excel export only the date as string and the time is not saved at all.
We are usin .NET, version 4.1.2011.4192.

The exported file looks as follow:
<table border="1">
<tr><td>X</td><td>Y</td></tr>
<tr><td>27/04/2011</td><td>20</td></tr>
<tr><td>27/04/2011</td><td>30</td></tr>
<tr><td>27/04/2011</td><td>40</td></tr>
<tr><td>27/04/2011</td><td>50</td></tr>
<tr><td>27/04/2011</td><td>40</td></tr>
</table>
bellow code example that reproduce the problem

Code: Select all

        public Form1()
        {
            InitializeComponent();

            tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:mm:ss\n";
            tChart1.Axes.Bottom.Labels.MultiLine = false;
            tChart1.Aspect.View3D = false;
            tChart1.Aspect.ZOffset = 0;
            Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line();         
            
            line.XValues.DateTime = true;
            line.Pointer.Visible = true;
            line.LinePen.Width = 2;
            line.TreatNulls = TreatNullsStyle.DoNotPaint;

            tChart1.Series.Add(line);

            line.Add(DateTime.Now - new TimeSpan(5, 0, 0), 20);
            line.Add(DateTime.Now - new TimeSpan(4, 0, 0), 30);
            line.Add(DateTime.Now - new TimeSpan(3, 0, 0), 40);
            line.Add(DateTime.Now - new TimeSpan(2, 0, 0), 50);
            line.Add(DateTime.Now - new TimeSpan(1, 0, 0), 40);
                
        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Export.Data.Excel.Series = null; // export all series
            tChart1.Export.Data.Excel.Save("Chart1.xls");        
        }


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

Re: export datetime data to excel

Post by Sandra » Wed Apr 27, 2011 12:01 pm

Hello alianak74,

I'm afraid this is not possible for now and it is added yet in wish-list with number (TF02014823) as explain in this thread.

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

alinak74
Newbie
Newbie
Posts: 4
Joined: Tue Feb 01, 2011 12:00 am

Re: export datetime data to excel

Post by alinak74 » Wed Apr 27, 2011 12:38 pm

Hi,

This is a BUG and not some new requirement, and it's different from the task TF02014823.
In TF02014823 user get a double for x-axis data. I wish to get a double value or any other with full information, but I get a string and format is different from axis format ( date only). So why this format???

You should give to this issue different priority!!

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

Re: export datetime data to excel

Post by Sandra » Wed Apr 27, 2011 2:27 pm

Hello alinak74,

I apologize, when I recommended you saw the solution of the link. I didn’t realize that the thread talked about XML and all the time I read xls, sorry my previous answer isn’t a solution for your problem.
So is allowed export all of date time in xls format, you only have change the format of DateTimeFormat before export date as do in next lines of code:

Code: Select all

     private void button1_Click(object sender, EventArgs e)    
        {
            tChart1[0].DateTimeFormat = "dd/mmm/yyyy hh:mm:ss";
            tChart1.Export.Data.Excel.Series = null; // export all series
            tChart1.Export.Data.Excel.Save(@"Chart1.xls");
        }
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
Image Image Image Image Image Image
Instructions - How to post in this forum

alinak74
Newbie
Newbie
Posts: 4
Joined: Tue Feb 01, 2011 12:00 am

Re: export datetime data to excel

Post by alinak74 » Thu Apr 28, 2011 7:22 am

Thanks Sandra, now it's ok!

Post Reply