Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Phillip Davies
  Where is Phillip Davies?
 TRURO
 United Kingdom
 Phillip Davies
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: XLS
Thread ID: 373355 Message ID: 373397 # Views: 40 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Projects and Design
Date: Thursday, March 21, 2013 11:49:04 PM         
   


Cetin

That's just brilliant, what can I say
Thank you very much

Phillip




>
> Oh than that is very easy and can be done in multiple ways. One of the easiest is to get the data into an array, tranpose it on VFP side and put transposed array values into excel. ie:
>
>
>
Local Array laData[1]
> Select accountNo, accName, age, dummy From crsSampleData Into Array laData
> 
> Local ix, jx
> Dimension aMyData[ALEN(laData,2), ALEN(laData,1)]
> For ix = 1 To Alen(laData,1)
>   For jx = 1 To Alen(laData,2)
>     aMyData[m.jx,m.ix] = laData[m.ix, m.jx]
>   Endfor
> Endfor
> 
> Local oExcel, loRange
> oExcel = Createobject('excel.application')
> With oExcel
>   .Workbooks.Add
>   .Visible = .T.
>   With .ActiveWorkbook.ActiveSheet
>     .Range( .Cells(1,1), .Cells(Alen(aMyData,1),Alen(aMyData,2))).Value = getArrayRef('aMyData')
>   Endwith
> Endwith
> 
> Procedure getArrayRef(tcArrayName)
>   Return @&tcArrayName
> Endproc
> 
> Procedure CreateSampleData
>   Create Cursor crsSampleData (accountNo c(10), accName c(15), age i, dummy c(6))
>   Local ix
>   Rand(-1)
>   For ix=1 To 1500
>     Insert Into crsSampleData ;
>       (accountNo, accName, age, dummy) ;
>       VALUES ;
>       (Textmerge('ACC<< m.ix >>'), ;
>       TEXTMERGE('Mr #<< m.ix >>'), ;
>       RAND()*60+10, ;
>       TEXTMERGE('PC<< m.ix >>'))
>   Endfor
>   Brow
> Endproc
> 

>
>

> Cetin Basoz
>
> .Net has got better.Think about moving - check my blog:
> My Blog
>

> MongoDb Certified Developer
> MongoDb Certified DBA
>

> Support Wikipedia

ENTIRE THREAD

XLS Posted by Phillip Davies @ 3/21/2013 2:26:27 PM
RE: XLS Posted by Cetin Basoz @ 3/21/2013 3:01:15 PM
RE: XLS Posted by Phillip Davies @ 3/21/2013 8:45:13 PM
RE: XLS Posted by Anders Altberg @ 3/21/2013 9:20:37 PM
RE: XLS Posted by Cetin Basoz @ 3/21/2013 10:17:07 PM
RE: XLS Posted by Phillip Davies @ 3/21/2013 11:49:04 PM