Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with exporting data to Excel
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00661373
Message ID:
00661422
Vues:
18
I think it look nicer with < pre > tag. :)
>We posted a tip on this in the May 2002 Newsletter at
>VFUG ( http://vfug.org:8080/ ).
>
>Here it is (with proper credit given to the author):
>
>Overcoming Excel's 16,384 Line Limit
>************************************
>If you try to copy a DBF to an Excel spreadsheet using the
>
>COPY TO Myfile.xls TYPE XL5
>
>command, you'll find that only the first 16,384 lines are exported. The following code breaks up a dbf into 'chunks' of 16,383 lines and copies each segment to a different spreadsheet. You can either use copy/paste to bring the data together or use OLE Automation.
>
*-----------------------------------------------------------------------*
* CreateXls breaks up a copy of a table into Excel spreadsheets.
*-----------------------------------------------------------------------*
LPARAMETERS pSourceTbl, pSourceAls, pXlsFile
StartAt = 1
MaxXlsRows = 16383            && MAX NUMBER OF EXCEL ROWS IN EXCEL 97 not including header
EndAt = MaxXlsRows

USE (pSourceTbl) ALIAS (pSourceAls) IN 0      // You may have a preferred way to select a table
IF RECCOUNT() < MaxXlsRows
     COPY TO ((pXlsFile + ".Xls")) TYPE XL5
ELSE
     FOR XlsLoopCtr = StartAt TO CEILING(RECCOUNT()/MaxXlsRows)
          XlsFile = pXlsFile + LTRIM(STR(XlsLoopCtr,2)) + '.Xls'
          COPY TO (XlsFile) TYPE XL5 FOR BETWEEN(RECNO(),StartAt,EndAt)
          StartAt = StartAt + MaxXlsRows
          EndAt = EndAt + MaxXlsRows
     NEXT XlsloopCtr
ENDIF
RETURN .T.
>Bill Koretoff
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform