Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel file with Memo fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01544667
Message ID:
01544720
Vues:
33
>>>Naomi, the only way I was ever able to get excel columns to not get truncated when importing to DBF was to use Excel automation.
>>
>>Can you please post your program if that's not too much to ask? I found one old program of mine, but it errors out.
>
>Tried to grab the bits that were important... some adjustment will be necessary.
>
>
>TRY
>	oExcel=CREATEOBJECT("Excel.Application")
>	oExcel.Workbooks.Open(lcFileNameWithPath,.F.,.T.)
>CATCH TO oErr
>	MESSAGEBOX("Error: "+ALLTRIM(oErr.message),0+64+0,_screen.Caption)
>ENDTRY
>
>FOR lnRow=1 TO lnExcelRows
>	FOR lnColumn=1 TO lnExcelColumns
>		TRY
>			IF lnColumn<=26		&& Single letter column
>				lcExcelColumn=CHR(64+lnColumn)
>			ELSE			&& double letter column starting with "A"
>				lcExcelColumn="A"+CHR(64+(lnColumn-26))
>			ENDIF
>			
>			lcCellValue=NVL(oExcel.Range(lcExcelColumn+ALLTRIM(STR(lnRow+1))).Value,"")
>		CATCH TO oErr
>			MESSAGEBOX("Error encountered with Excel automation: "+ALLTRIM(oErr.message),0+64+0,_screen.Caption)
>			lcCellValue=""
>		ENDTRY
>	ENDFOR
>ENDFOR
>
>oExcel.Workbooks.Close()
>RELEASE oExcel
>
>
Thanks a lot, I've added post-processing of the file to fix memo field.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform