Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert
Message
 
À
15/08/2005 08:04:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Divers
Thread ID:
01040893
Message ID:
01040920
Vues:
21
If will have such a problems, because Excel keeps DATE fields as a days passed from 01/01/1900 (If I remember well) and all numeric fields with a big precision, so you must conveert it back to VFP Date and Number with precission you want.

About USE (lcExcelFile) IN 0 && message not atable
My mistake
USE (JUSTSTEM(lcExcelFile)) IN 0
>hi,
>thank you very much,
>
>i try with
>
>LOCAL lcExcelFile
>lcExcelFile = GETFILE("XLS")
>IF NOT EMPTY(lcExcelFile)
>   IMPORT FROM (lcExcelFile) XL5  && You can include SHEET TheNameOfTheSheet here
>   USE (lcExcelFile) IN 0
>   BROWSE NORMAL
>ENDIF
>
>1.but i have field at my sheet as date 1/1/2005,i see it as number,
>and other fileld as number 142.876 see it as 142.8765421.....
>
>2. USE (lcExcelFile) IN 0 && message not atable
>thanks
>>>hi,
>>>OK. my Workbook have just one sheet .
>>>>>hi all,
>>>>>
>>>>>would you help me.
>>>>>to convert my excell sheet to vfp.table
>>>>>
>>>>>as
>>>>>1.getfile() &&choice any excell sheet
>>>>>
>>>>>2. convert this sheet to vfp.table
>>>>>
>>>>>thanks
>>>>
>>>>You can't use GETFILE() to receive the Sheets contained in Excel Workbook. You can use it to get the Excel Workbook only.
>>
>>The easiest way is:
>>
>>LOCAL lcExcelFile
>>lcExcelFile = GETFILE("XLS")
>>IF NOT EMPTY(lcExcelFile)
>>   IMPORT FROM (lcExcelFile) XL5  && You can include SHEET TheNameOfTheSheet here
>>   USE (lcExcelFile) IN 0
>>   BROWSE NORMAL
>>ENDIF
>>
>>BUT you must know what column what information contains. I mean this way you can get a DBF that have fields like:
>>A B C ... and you must know What data "A" field have.
>>
>>Other way is to use automation, but you must have Excel installed in all computers that your application will run:
>>
>>LOCAL lcExcelFile, loExcel
>>lcExcelFile = GETFILE("XLS")
>>IF NOT EMPTY(lcExcelFile)
>>   loExcel = CREATOBJECT("Excel.Application")
>>   loExcel.Open(lcExcelFile)
>>   CREATE CURSOR MyExcel (.........) && Field List of the cursor you want to import
>>   WITH loExcel.ActiveWorkBook
>>        FOR nRow = 1 TO .Rows.Count
>>            APPEND BLANK IN MyExcel
>>            FOR nCol = 1 TO .Columns.Count
>>                lcField = FIELDS(nCol)
>>                REPLACE (lcField) WITH .Cells(nRow, nCol).Value  && With proper transformations if you needed one
>>            NEXT
>>        NEXT
>>   ENDWITH
>>ENDIF
>>
>>
>>Keep in mind that the Automation section here is not tested and I didn't put any error handling.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform