#How make a pie chart in excel code#
Take a moment to peruse the documentation, where you will find other options like move or copy a worksheet, freeze, unfreeze and split panes, show or hide worksheet and worksheet tabs, page setup settings and more with code examples.Ĭlick here to explore the rich set of Syncfusion Excel (XlsIO) library features. On the Insert tab, in the Charts group, click the Pie symbol. Step 2 - Insert the type of pie chart you want. Result: Note: enter a title by clicking on Chart Title. On the Insert tab, in the Charts group, click the Line symbol. Position = ExcelDataLabelPosition.BestFitĭim stream As Stream = File.Create("Output.xlsx")Ī complete working example to create a pie of pie chart can be downloaded from PieOfPieChart.zip. To create a line chart, execute the following steps. 'Open existing workbook with data enteredĭim assembly As Assembly = GetType(Program).GetTypeInfo().Assemblyĭim fileStream As Stream = assembly.GetManifestResourceStream("")ĭim workbook As IWorkbook = (fileStream)ĭim worksheet As IWorksheet = workbook.Worksheets(0)ĭim chart As IChartShape = ()Ĭhart.ChartType = ExcelChartType.PieOfPieĬ = ExcelLegendPosition.Bottom Using excelEngine As ExcelEngine = New ExcelEngine()ĭim application As IApplication = excelEngine.ExcelĪpplication.DefaultVersion = ExcelVersion.Excel2016
Public Shared Sub Main(ByVal args As String()) Stream stream = File.Create("Output.xlsx") Position = ExcelDataLabelPosition.BestFit IChartShape chart = () Ĭhart.ChartType = ExcelChartType.PieOfPie Ĭ = ExcelLegendPosition.Bottom IWorksheet worksheet = workbook.Worksheets Stream fileStream = assembly.GetManifestResourceStream("") Open existing workbook with data enteredĪssembly assembly = typeof(Program).GetTypeInfo().Assembly Then click the Insert tab, and click the dropdown menu next to the image of a pie chart. IApplication application = excelEngine.Excel Īpplication.DefaultVersion = ExcelVersion.Excel2016 To create a pie chart in Excel 2016, add your data set to a worksheet and highlight it. Using (ExcelEngine excelEngine = new ExcelEngine())