1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| //recuperation de l'onglet courant
CurrentSheet := ExcelApp.ActiveWorkbook.ActiveSheet;
//creation de l'objet graphiques
ChartObject := CurrentSheet.ChartObjects.Add(0,0,1,1);
// definition propriete top du graphique
ChartObject.Top := CurrentSheet.Range['A'+IntToStr(BaseRow+2),'A'+IntToStr(BaseRow+2)].Top;
ChartObject.Left := 0;
ChartObject.Width := CurrentSheet.Range['H63','H63'].Left;
ChartObject.Height := CurrentSheet.Range['A63','A63'].Top - ChartObject.Top;
// type de graphique
ChartObject.Chart.ChartType := xlLine;
ChartObject.Chart.HasDataTable := FALSE;
//recherche de données
DataSheet := ExcelApp.ActiveWorkbook.Sheets['Datas'];
ChartObject.Chart.SetSourceData(Source:=DataSheet.Range['A3',MaxLetter+'18'], PlotBy:=xlRows); |
Partager