Information générale
Catégorie:
Codage, syntaxe et commandes
>>More polished than my 1liner for sure ;-) Quick nosy question - did you compare your approach of writing out to file and concatenating header line with that file to _clip to inserting header line and then inserting one row down directly fro .DataToClip(,,3)? On current SSD probably irrelevant, but it perked my "find best way" character deficit ;-)
>
>Did that regularly 10-12 years ago, and it was drastically faster. And it's not the amount of data (SSD being irrelevant for the case) but in the sheer amount of COM/DOM addressing when playing automation cell-by-cell or massaging a csv to do exactly what we want and not be misinterpreted. _vfp.datatoclip(,,3) combined with oExcel.Range.Paste() is the fastest I've found so far.
>
From Cetins code you had deleted:
> lcTempFile = Sys(2015)+".txt"
> Copy Next m.lnMaxRows-1 To (m.lcTempFile) Delimited With Tab
> _Cliptext = m.lcHeader + Filetostr(m.lcTempFile)
> Erase (lcTempFile)
> .Range("A1").PasteSpecial()
Both approaches use the clipboard, only Cetin goes first to disk, then concats, whereas my idea would be to paste twice: first for the single header line, then for the whole table loaded directly with datatoclip(,,3), somthing like
> _Cliptext = m.lcHeader
> .Range("A1").PasteSpecial()
> _vfp.datatoclip(,,3)
> .Range("A3").PasteSpecial()
Therefore I think disk speed might play a role comparing both approaches, even if as here maybe only a part of table will be copied - a vfp cursor often does not need to write if filter is simple enough and filling the clipboard from there could be faster than the explicit copy to, filetostr() dance needed for concat and single paste ;-)
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement