Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem inserting date into Excel Sreadsheet
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00809556
Message ID:
00809558
Vues:
29
>Hi
>
>I am inserting data into an Excel spreadsheet. It works fine except for the date. I am using dd/mm/yyyy
>
>If I pass Excel 26/01/2003 it is quite happy
>
>But If I pass it 01/07/2003 it doesnt seem to be able to work out which date it is. (ie Jan 7th or July 1st)
>
>What can I do about it?
>
>Colin

Colin,

a bypass
                              case inlist(h[i,4], T_DATE)
					if( empty(x) )
						loop
					else
						x = dtos(x)
						_yy = left(x,4)
						_mm = substr(x,5,2)
						_dd = substr(x,7,2)
						
						x = '=date(' + _yy + ',' + _mm + ',' + _dd + ')'
					endif
				
				case inlist(h[i,4], T_DATETIME)
					if( empty(x) )
						loop
					else
						x = ttoc(x,1)
						_yy = left(x,4)
						_mm = substr(x,5,2)
						_dd = substr(x,7,2)
						_hh = substr(x,9,2)
						_min = substr(x,11,2)
						_sec = substr(x, 13, 2)
						
						x = '=date(' + _yy + ',' + _mm + ',' + _dd + ')' ;
							+ '+time(' + _hh + ',' + _min + ',' + _sec + ')'
					endif
                               .....
                               endcase

                            xlSheet.Cells[nRow,i].Value = x

&& you can set the numberformat as well

xlsheet.Columns(i).NumberFormat = 'dd/mm/yyyy' && 'dd/mm/yyyy hh:mm:ss'
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform