I’m working on uploading data to Excel 2003 tables and charts. There are a dozen charts on the sheet and I need to configure them one by one.
At the moment I am getting an Excel chart by its ordinal number ( aId ) like this:
sheet := Excel.ActiveWorkBook.Sheets[aSheetName]; // Выбираем лист sheet.ChartObjects[aId].Activate; // Активируем aChartId диаграмму chart := Excel.ActiveWorkBook.ActiveChart; // Получаем диаграмму для работы The problem is that the order / sequence of diagrams is clearly not visible in Excel, and when inserting new diagrams, you have to cut / paste them all in order for their indices to go in order (for example, from top to bottom).
The question is how to get a chart knowing the cell above which it is located? (assuming that there is only 1 diagram above the cell). Something like chart := sheet.ChartObjects.FindByCell(x, y);