Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel graphs
Message
De
05/03/2006 12:31:42
 
 
À
22/02/2006 11:07:46
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Divers
Thread ID:
01098041
Message ID:
01101585
Vues:
18
>>Hi
>>I have a code that populate data in excel.
>>Every thing is good but I have few small problems:
>>1. I have a graph in the excel with title base on total of my data, how can I feel the graph title with code.
>>2. The excel file open as read only (I can write but to save only with other name), how can I change it?
>>3. My graph showing total from 1998 till 2005, But my uery will bring another line next year (2006) and another in the year after, how can I tell the graph to show all the years?
>>
>>Here is the code:
#include c:\reports\others\xl97cons.h
>>#define xltrue -1
>>#define xlfalse 0
>>
>>local oexcel, osheet
>>oexcel = createobject("Excel.Application")
>>oexcel.visible = 0  && for debugging
>>oexcel.workbooks.open("c:\exc\test.xls")
>>osheet = oexcel.activesheet
>>nline=2
>>select t2
>>scan
>>    nline=nline+1
>>    iyear=int(t2.year)
>>    icount=int(t2.count)
>>   iall=int(t2.all)
>>    osheet.cells(nline,2).value =iyear
>>    osheet.cells(nline,3).value = icount
>>    osheet.cells(nline,4).value = iall
>>endscan
>>
>>oexcel.visible = -1   && for debugging
>>
>>osheet.parent.saved = xltrue
>>
>>
>>Thanks
>
>Chaim,
>You're filling the cell values in the worst style you could ever find:( Anyway it wouldn't matter much for few rows and columns. Here is a sample answering your questions partially:
>
>
>Create Cursor _sample (Year b(2),Count b(2),All b(2))
>For ix = 1 To 10
> Insert Into _sample Values ;
>  (1997+m.ix,;
>  Rand()*1000,;
>  Rand()*1000)
>Endfor
>
>Local lcTemp
>lcTemp = Forcepath( Sys(2015)+'.txt',Sys(2023) )
>Select Int(Year),Int(Count),Int(All) From _sample Into Cursor crsData
>Copy To (m.lcTemp) Type Delimited With Tab
>_Cliptext = "Year"+Chr(9)+"Count"+Chr(9)+"All"+Chr(13)+Filetostr(m.lcTemp)
>Erase (m.lcTemp)
>
>#include xlconstants.h
>
>Local oexcel
>oexcel = Createobject("Excel.Application")
>oexcel.workbooks.Add
>oexcel.Visible = .T.
>With oexcel.ActiveWorkBook.ActiveSheet
> .Range('B2').PasteSpecial
> oRange = .Application.Selection
> With oRange
>  oChartRange  = .Range(.Cells(0,1), .Cells(.Rows.Count-1, 2))
>  oLabelsRange = .Range(.Cells(1,0), .Cells(.Rows.Count-1, 0))
> Endwith
> .ChartObjects.Add(200, 10, 300, 300)
> With .ChartObjects(1).Chart
>  .SetSourceData(oChartRange, xlColumns)
>  .hastitle = .T.
>  .haslegend = .T.
>  .ChartTitle.Caption = "My Custom Chart Title"
>  .ChartType = xlColumnClustered
>  .SeriesCollection(1).XValues = oLabelsRange
> Endwith
>Endwith
>
If you base your chart on a pivot table then you wouldn't need adjustments on ranges but simply provide new data for your pivot.
>Cetin
Hi I m sorry that I respond so late.
Any way, I didn't find any way to update pivot table with more rows even directly manually in excel.
Thank you
Chaim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform