I’m trying to modify a chart from an opened excel worksheet. There is only one chart in the worksheet.
My code is simple, but the “chart.Count” returns me a zero. Pls advise me the correct way to select the chart if I’m wrong. Thx a lot!
My testing code:
Charts chart = excel.Worksheets[RCHART_WORKSHEET_NUM].Charts;
int size = chart.Count;
Currently Aspose.Excel doesn’t allow you to modify a chart in your designer file. You can only change the data of the chart.
For example, chart data source is A1:B5, you can modify the data in A1 to B5. Then the chart in the result file will reflect this change.
This is my scenario, I have an excel file (a template for my program), with a chart in one worksheet and it’s datasource in another. In my program, I will update the data of the chart’s datasource and the chart will reflect the changes. I already got this and it is working fine. However, there is another thing i need to do is that I need to change the Chart Title as well as the title, Min n Max value of the X/Y Axis.
I saw some code from this forums:
chart.CategoryAxis.Title.Text = “Kalenderwochen”;
chart.ValueAxis.Title.Text = “Anzahl Fzg. (Anlieferung Montage) pro KW”;
If i’m not wrong, it’s setting the title for X/Y Axis. If this can be done, how do I select my chart from the worksheet to do these setting? I tried “Chart chart = sheet.Charts;” but it return a null.
* Is there any alternative if the above cannot be done? Create new Chart in worksheet instead of reading from template?