Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dates in excel 2010
Message
 
 
À
30/11/2012 17:12:41
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Divers
Thread ID:
01558464
Message ID:
01558509
Vues:
44
>>>>Try "Save As"
>>>
>>>Easier: since I already have a list of date column names, I'm simply widening the column so the .text will be a digit now:
>>>
*---------------------------------------------------
>>>	PROCEDURE GetColumnNames(tn)
>>>*[2012/11/26 17:39:35] ndragan - just use the clipboard
>>>		LOCAL aF[1], lnfields
>>>		loXls=this.oexcel
>>>		loxls.ActiveSheet.ROWS(tn).SELECT
>>>		loxls.SELECTION.COPY()
>>>		_CLIPTEXT=TRIM(_CLIPTEXT, 1, 0h0d)
>>>		lnfields=ALINES(aF, _CLIPTEXT, hTab)
>>>		DIMENSION THIS.aFld[lnFields]
>>>		ACOPY(aF, THIS.aFld)
>>>		*[2012/11/30 15:20:39] ndragan - widen the date fields so that Excel2010 doesn't see ######.
>>>		FOR i=1 to lnFields
>>>			IF lower(af[i])$this.cValueFieldsList
>>>				loxls.columns(i).ColumnWidth = 15.57
>>>			endif
>>>		ENDFOR
>>>
>>>Which now works even without saving the file. I just wish I didn't have to waste so much time on this.
>>>
>>>
>>
>>PMFJI. I am always looking at how people extract data from excel to VFP. And I am trying to understand your code but it goes over my head. Hopefully, if it is not too much trouble, I can ask you. How do you get the value of 'tn" that you pass to this function? And one more; what is the 'this.oexcel' you use in this function? TIA.
>
>Tn is the row with the header, usually 1 but I've seen multiline headers, so I've put it as parameter just in case.
>
>"This" is, in my case, a wrapper class that has all the code I'd need that's common to various import scenarios; this.oExcel is an instance of excel that it creates.

Thank you. Do I understand correctly that your code (the segment of which is shown above) connects to an Excel and then copies data from the Excel spreadsheet into some other format (e.g. cursor)?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform