Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fill Excel range with XML?
Message
From
19/11/2003 04:40:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/11/2003 14:44:35
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00849641
Message ID:
00851313
Views:
25
>Hi all
>
>I've got about 10,000 records to dump into Excel. There are about 10 client with that many records each. As Tamar Granor puts it in her (and Della Martin's) book, "This method of populating the data ... performs well on small data sets".
>
>I'm wondering if there is a way to get Excel to fill a range with a chunk of XML. If so, please share some example code.
>
>Thanks!

Mike,
Directly using XML should be version dependant (at least the version I'm using - XL2000 - doesn't have a direct support). Indirectly it could use OLEDB with MSDAOSP provider but really sucks IMHO.

OTOH you could easily use XMLToCursor() and manipulate data for excel. Passing this data to excel has a zillions way of doing it and each approach have some pros/cons. One of the simpliest ways is to copy the data to a tab delimited format and paste to a range in excel. ie:
use (_samples+'data\orditems')

lcTemp = Sys(2015)+'.tmp'
Copy To (lcTemp) Type csv for .f.
_Cliptext = Chrtran(Filetostr(lcTemp),',',Chr(9))
Copy To (lcTemp) Type Delimited With "" With Tab
_Cliptext = _Cliptext + Filetostr(lcTemp)
Erase (lcTemp)

USE in 'orditems'

oExcel = Createobject('Excel.Application')
With oExcel
  .Workbooks.Add
  .Activeworkbook.Activesheet.Range('B5').PasteSpecial()
  .Selection.Name = 'myData' && Name the part we pasted
  .Range('A1').Activate      && Just to release current selection
  .Range('myData').Columns.Autofit && Use named range
  .Visible = .T.
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform