Click here to Skip to main content
15,915,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to change the Layout of chart in excel sheet. Here is my code.

C#
Excel.Range chartRange;

                  Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
                  Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(225, max * 15, 300, 250);
                  Excel.Chart chartPage = myChart.Chart;
                  chartPage.ChartArea.Font.Name = "BankGothic Lt BT";
                  chartRange = xlWorkSheet.get_Range("K7", "L8");
                  chartPage.SetSourceData(chartRange, misValue);
                  chartPage.ChartType = Excel.XlChartType.xl3DPieExploded;



I type as
C#
myChart.ApplyLayout(10, myChart.ChartType); // But its not taken showing error.
Posted
Updated 15-May-12 19:46pm
v2

1 solution

ApplyLayout is the right method. Ref: http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.chart.applylayout.aspx[^]

Could you verify whether the assembly Microsoft.Office.Tools.Excel is referred properly via Microsoft.Office.Tools.Excel.dll
 
Share this answer
 
Comments
ssyuvaraja 16-May-12 2:09am    
Excel.Chart chartPage. Like this only i used to create a excel.
ssyuvaraja 16-May-12 2:20am    
got it thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900