Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Better way to code Excel automation?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01313820
Message ID:
01314033
Vues:
19
Hi Albert,

depends on the version of Excel. If you can safely assume that Office XP or later is used, I would avoid automation completely. Excel XP, Excel 2003 and Excel 2007 allow to save spreadsheets in XML files. It's way simpler than automation to merely open the XLS file given by your client, save it as an XML spread sheet and replace all cell values with textmerge expressions. Then use something like TEXTMERGE(FILETOSTR()) to generate the entire spreadsheet in a single line. To view it in Excel, you can use a line like this:
	Local loExcel, lcFile
	lcFile = FullPath("Test.xml")
	StrToFile( m.lcXML, m.lcFile)
	loExcel = CreateObject("Excel.Application")
	loExcel.Visible = .T.
	Try 
		loExcel.Workbooks.Add(m.lcFile)
	Catch
	EndTry 
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform