Information générale
Catégorie:
COM/DCOM et OLE Automation
Hello everyone,
I have to fill a graph in Excel with data. But I do not know how I can do it.
The code I have until now is:
#DEFINE xlEdgeBottom 9
#DEFINE xlMedium -4138
#DEFINE xlLandScpae 2
#DEFINE xlWorkBookNormal -4143
#DEFINE xlBar 2
oExcel=CREATEOBJECT("Excel.Application")
oWorkBook=oExcel.WorkBooks.Open(m_excelbestand)
FOR m_teller=1 TO 4
oWorkBook.ActiveSheet.Rows(1).Insert
ENDFOR
oWorkBook.ActiveSheet.Range("A5:J5").Font.Bold=.T.
oWorkBook.ActiveSheet.Range("A5:J5").Borders(xlEdgeBottom).Weight=xlMedium
FOR m_teller=4 TO m_fieldcount
m_cel='"'+CHR(64+m_teller)+ALLTRIM(STR(m_regelnr))+'"'
m_formule="="+CHR(64+m_teller)+ALLTRIM(STR(m_regelnr-1))+;
"/("+CHR(67)+ALLTRIM(STR(m_regelnr-1))+;
"/100)"
oWorkBook.ActiveSheet.Range(&m_cel).Value=m_formule
ENDFOR
OWorkBook.ActiveSheet.Range("A1:Z200").Columns.Autofit()
oWorkSheet1=oWorkBook.WorkSheets[1]
oGraphSheet=oWorkBook.WorkSheets.Add(,oWorkSheet1)
oWorkBook.WorkSheets["Blad1"].Name="Grafiek"
oChart=oExcel.Sheets[2].ChartObjects.Add(45.7, 173.2, 319.5, 190.5)
oChart.Activate()
[Here I have to fill the graph with data from another sheet........]
oExcel.DisplayAlerts=.F.
oExcel.ActiveSheet.SaveAs(m_excelbestand, xlWorkBookNormal)
oWorkBook.Save()
oExcel.Quit()
RELEASE oExcel
Can anybody please tell me how I can give the range of data and the type of graph and maybe other parameters that I need?
Thanx in advance
Ron :o)
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement