Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Sub Total
Message
 
 
À
07/01/2007 23:49:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
01183355
Message ID:
01183356
Vues:
20
>Dear Experts
>
>
>CREATE CURSOR testsub (date1 d(8),sno n(2),cash n(2),weight n(2))
>INSERT INTO testsub VALUES ({^2007/01/01},1,100,10)
>INSERT INTO testsub VALUES ({^2007/01/01},2,150,20)
>INSERT INTO testsub VALUES ({^2007/01/01},3,300,30)
>INSERT INTO testsub VALUES ({^2007/01/02},4,200,40)
>INSERT INTO testsub VALUES ({^2007/01/02},5,400,50)
>INSERT INTO testsub VALUES ({^2007/01/02},6,300,60)
>INSERT INTO testsub VALUES ({^2007/01/03},1,100,70)
>
>
>By the following method all data goes to Excel properly.
>
>select testsub
>copy to 'C:\Xls\'+alltrim("Date Wise")+".xls" type xl5
>release all like lo*
>loexcel = createobject("Excel.Application")
>loworkbook = loexcel.workbooks.open('C:\Xls\'+alltrim("Date Wise")+".xls")
>losheet = loworkbook.sheets(1) && or pass the name of your sheet as a string!
>loexcel.visible = .t. && display Excel
>
>Now In Excel Sheet, I want to get Sub Totals as
>
>---date1----Sno--Cash--Weight
>01/07/2007---1---100-----10
>01/07/2007---2---100-----20
>01/07/2007---3---300-----30
>Sub Total----------500-----60
>02/07/2007---4---200-----40
>02/07/2007---5---400-----50
>02/07/2007---7---300-----70
>Sub Total----------900-----160
>03/07/2007---1---100-----70
>Sub Total----------100-----70
>
>Plaese help
select space(10) as TotColumn, * from testub ;
union all ;
select 'Sub Total ' as TotColumn, date1, 00 as sno, ;
sum(cash) as Cash, Sum(Weight) as Weight ;
from TestSub group by Date1 ;
order by Date1, sno desc into cursor curResult
Use this cursor instead.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform