Cannot access Chart Textboxes in aspose.cells

I have a template Excel spreadsheet which has 2 charts in it. I didn't design these charts its just my job to populate them with the correct data, and the person who designed the second chart put textboxes as labels within the chart area.

Using aspose I can populate the chart with data perfectly, however I need to be able to access these textboxes as the reports can be run in multiple languages, and so I need to update the textbox text to display the correct message for the selected language.

I've looked through the API and the developers guide but cannot find how to do this, am I missing something here? This is what I have so far:

Aspose.Cells.Workbook templateWorkbook = new Workbook();
templateWorkbook.Open(templateFileName);
Worksheet currentYearReportSheet = templateWorkbook.Worksheets["Report"];

//do data processing here and set NSeries data

I would like to be able to so something like:

currentYearReportSheet.Charts[1].TextBoxes.SetValue("Some Text")

Any Help would be great,

Thanks

Hi,

Thanks for considering Aspose.

Yes, you may do it, you can get the textbox object in the designer chart of the template excel file.

I have a chart in my sample template file and I have a textbox in this chart. I get the textbox object in the chart, change the text value and save the excel file. Following is my sample code which works fine here.

//Create a new Workbook.
Workbook workbook = new Workbook();
//Open the existing file.
workbook.Open("d:\\test\\tsttextboxchart.xls");
//Get the designer chart in the second sheet.
Worksheet sheet = workbook.Worksheets[1];
//Get the chart.
Chart chart = sheet.Charts[0];
//Get the textbox of the chart.
Aspose.Cells.TextBox textbox0 = (Aspose.Cells.TextBox)chart.Shapes[0];
//Change the text value.
textbox0.Text = "My new value";
//Save the excel file.
workbook.Save("d:\\test\\tsttextboxchart1.xls");

Thank you

Hi,

I've tried to use your code but the Chart object does not have a Shape property. I am using Aspose.Cells version 4.2.0.0, has this been introduced in a future release of Aspose.Cells?

Hi,

Thanks for considering Aspose.

No, these APIs are not available in 4.2.0.0. I think you should try 4.3.0.0 or greater versions.

Thank you.