V
vineetbatta
I have trying for some time now to add Title to the chart which i have created using the following code but it throws COM error -
System.Runtime.InteropServices.COMException: Unable to set the Text property of the ChartTitle class
The code is as following ...
Excel.Sheets sheets = thisWorkbook.Worksheets;
Excel.Worksheet thisWorksheet = (Excel.Worksheet)sheets.get_Item(1);
thisWorksheet = thisWorkbook.ActiveSheet as Excel.Worksheet;
Excel.ChartObjects charts =(Excel.ChartObjects)thisWorksheet.ChartObjects(Type.Missing);
Excel.ChartObject chartObj = charts.Add(100, 300, 500, 300);
Excel.Chart chart = chartObj.Chart ;
Excel.ChartTitle cht = chart.ChartTitle;
cht.Text = "Report";
If i remove the chartTitle code above (2 line) , it works fine.
Complete code not shown here for simplicity.
I also tried directly
Chart.ChartTitle.text = "Report";
AND
Chart.ChartTitle.caption = "Report";
Infact any thing related to chartTitle object i am not able to set at all.
Please let me know of any pointers.
Thanx in advance
System.Runtime.InteropServices.COMException: Unable to set the Text property of the ChartTitle class
The code is as following ...
Excel.Sheets sheets = thisWorkbook.Worksheets;
Excel.Worksheet thisWorksheet = (Excel.Worksheet)sheets.get_Item(1);
thisWorksheet = thisWorkbook.ActiveSheet as Excel.Worksheet;
Excel.ChartObjects charts =(Excel.ChartObjects)thisWorksheet.ChartObjects(Type.Missing);
Excel.ChartObject chartObj = charts.Add(100, 300, 500, 300);
Excel.Chart chart = chartObj.Chart ;
Excel.ChartTitle cht = chart.ChartTitle;
cht.Text = "Report";
If i remove the chartTitle code above (2 line) , it works fine.
Complete code not shown here for simplicity.
I also tried directly
Chart.ChartTitle.text = "Report";
AND
Chart.ChartTitle.caption = "Report";
Infact any thing related to chartTitle object i am not able to set at all.
Please let me know of any pointers.
Thanx in advance