Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying to a xlsx file
Message
De
30/09/2014 16:56:22
 
 
À
30/09/2014 14:01:47
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01608539
Message ID:
01608584
Vues:
51
>>>>>>Is there any way to COPY to an XLSX file rather than XLS?
>>>>>>
>>>>>>Would this also apply to VFP 5.0?
>>>>>
>>>>>If a MS Exccel is on the comp, automation can do the job.
>>>>
>>>>Do you mean by COPYing to a DELIM and then opening the DELIM file from Excel and saving it as an XLSX?
>>>
>>>No, I mean to use VFP to control MS Excel.
>>>
>>>just enter in the command window something like
>>>
>>>loExcel = createobject('Excel.Application')
>>>
>>>for start and then start to browse the pems of loExcel.
>>>
>>>You can do anything that is possible from VBA for Application (it's called like that?) That wahta does macros in Excel.
>>
>>Using the Excel object is what I meant.
>>
>>I would think that COPYing to a DELIM file and then using automation to read in the DELIM file with the Excel object and then saving it to a XLSX would be faster than constructing each row with the Excel object, especially if we're talking a large file.
>>
>>Thanks for the suggestion.
>
>Why row by row? There are only two ways: cell by cell or range. A range could be all at once.
>If you use automation to create / save the file + writing the data as one selection of range and one value assignment will not be slower then creating a external file and importing it.
>It also gives you the posibility to export memos, and do any alteration you like.
>
>Lutz

Turns out it is as simple as this:
LOCAL loExcel AS Excel.APPLICATION

USE foo

copy to xoo XL5

loExcel = CREATEOBJECT("Excel.application")
loExcel.VISIBLE = .F.
loExcel.displayalerts = .F.
loExcel.AskToUpdateLinks = .F.

lcFileName = 'xoo'

loWorkBook = loExcel.Workbooks.OPEN(lcFileName + '.xls')
loWorkBook.SAVEAS(lcFileName + '.xlsx', 51)  && xlOpenXMLWorkbook = 51

loWorkBook.CLOSE()

loExcel.QUIT()
RELEASE loExcel
loExcel = NULL

DELETE FILE xoo.xls
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform