From a85c96f9faf09b586b1fcb5c72e158c8b904736a Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Fri, 29 Sep 2023 12:25:19 +0530 Subject: [PATCH 1/3] 850175-RoundedCorner-Chart-Add the Rounded corner chart --- ...nded-corner-for-chart-in-excel-document.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md diff --git a/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md b/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md new file mode 100644 index 000000000..40965f59a --- /dev/null +++ b/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md @@ -0,0 +1,124 @@ +--- +title: How to set rounded corner for chart in excel document | Syncfusion +description: Code example to set rounded corner for chart in excel document using Syncfusion .NET Excel library (XlsIO). +platform: file-formats +control: XlsIO +documentation: UG +--- + +# How to set rounded corner for chart in Excel document? + +The following code snippet shows how to set rounded corner for chart in Excel document. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet sheet = workbook.Worksheets[0]; + + object[] xValues = new object[] { "Total Income", "Expenses", "Profit" }; + object[] yValues = new object[] { 2000, 1000, 1500 }; + + //Adding series and values + IChartShape chart = sheet.Charts.Add(); + IChartSerie serie = chart.Series.Add(ExcelChartType.Column_Clustered); + + //set the rounded border for the chart + chart.ChartArea.IsBorderCornersRound = true; + + //sets the top row of the chart + chart.TopRow = 5; + chart.BottomRow = 20; + chart.LeftColumn = 5; + chart.RightColumn = 13; + + //Enters the X and Y values directly + serie.EnteredDirectlyValues = yValues; + serie.EnteredDirectlyCategoryLabels = xValues; + + //Saving the workbook as stream + FileStream stream = new FileStream("Chart.xlsx", FileMode.Create, FileAccess.ReadWrite); + workbook.SaveAs(stream); + stream.Dispose(); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet sheet = workbook.Worksheets[0]; + + object[] xValues = new object[] { "Total Income", "Expenses", "Profit" }; + object[] yValues = new object[] { 2000, 1000, 1500 }; + + //Adding series and values + IChartShape chart = sheet.Charts.Add(); + IChartSerie serie = chart.Series.Add(ExcelChartType.Column_Clustered); + + //set the rounded border for the chart + chart.ChartArea.IsBorderCornersRound = true; + + //sets the top row of the chart + chart.TopRow = 5; + chart.BottomRow = 20; + chart.LeftColumn = 5; + chart.RightColumn = 13; + + //Enters the X and Y values directly + serie.EnteredDirectlyValues = yValues; + serie.EnteredDirectlyCategoryLabels = xValues; + + //Saving the workbook + workbook.SaveAs("Chart.xlsx"); + stream.Dispose(); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As ExcelEngine = New ExcelEngine() + Dim Application As IApplication = excelEngine.Excel + Application.DefaultVersion = ExcelVersion.Xlsx + Dim workbook As IWorkbook = Application.Workbooks.Create(1) + Dim sheet As IWorksheet = workbook.Worksheets(0) + + Dim xValues As Object() = New Object() {"Total Income", "Expenses", "Profit"} + Dim yValues As Object() = New Object() {2000, 1000, 1000} + + 'Adding series And values + Dim chart As IChartShape = sheet.Charts.Add() + Dim serie As IChartSerie = chart.Series.Add(ExcelChartType.Column_Clustered) + + 'set the rounded border for the chart + chart.ChartArea.IsBorderCornersRound = True + + 'sets the top row of the chart + chart.TopRow = 5 + chart.BottomRow = 20 + chart.LeftColumn = 5 + chart.RightColumn = 13 + + 'Enters the X And Y values directly + serie.EnteredDirectlyValues = yValues + serie.EnteredDirectlyCategoryLabels = xValues + + 'Saving the workbook as stream + Dim Stream As FileStream = New FileStream("Chart.xlsx", FileMode.Create, FileAccess.ReadWrite) + workbook.SaveAs(Stream) + Stream.Dispose() +End Using +{% endhighlight %} +{% endtabs %} + +## See Also + +* [How to change the border style for chart series](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#border-style-for-chart-series) +* [How to explode a Pie Chart](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#explode-a-pie-chart) +* [How to add picture to the chart and assign hyperlink](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#add-picture-to-chart-and-assign-hyperlink) +* [How to customizing chart and chart elements](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#customizing-chart-and-chart-elements) +* [How to add data label to the chart](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#add-datatable-to-chart) \ No newline at end of file From 1bcb7765bee3db44ccb14abc5d095027a8eaaf38 Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Fri, 29 Sep 2023 12:29:15 +0530 Subject: [PATCH 2/3] 850175-RoundedCorner-Chart-Add file path --- File-Formats-toc.html | 1 + 1 file changed, 1 insertion(+) diff --git a/File-Formats-toc.html b/File-Formats-toc.html index 4266ef7e0..bdf1080a3 100644 --- a/File-Formats-toc.html +++ b/File-Formats-toc.html @@ -1232,6 +1232,7 @@
  • Why cone chart shows itself as column or bar chart
  • How to vary colors by point for line and column chart
  • How to upload a file to Azure blob and download as stream
  • +
  • How to set rounded corner for chart in Excel document
  • From 3761976de5d4debf6292f39a6e17a2ecc419ce1d Mon Sep 17 00:00:00 2001 From: MOHAN CHANDRAN <93247949+Mohan2401@users.noreply.github.com> Date: Fri, 29 Sep 2023 14:09:41 +0530 Subject: [PATCH 3/3] Update how-to-set-rounded-corner-for-chart-in-excel-document.md --- ...how-to-set-rounded-corner-for-chart-in-excel-document.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md b/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md index 40965f59a..c85d010e9 100644 --- a/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md +++ b/File-Formats/XlsIO/faqs/how-to-set-rounded-corner-for-chart-in-excel-document.md @@ -1,6 +1,6 @@ --- -title: How to set rounded corner for chart in excel document | Syncfusion -description: Code example to set rounded corner for chart in excel document using Syncfusion .NET Excel library (XlsIO). +title: How to set rounded corner for chart in Excel document | Syncfusion +description: Code example to set rounded corner for chart in Excel document using Syncfusion .NET Excel library (XlsIO). platform: file-formats control: XlsIO documentation: UG @@ -121,4 +121,4 @@ End Using * [How to explode a Pie Chart](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#explode-a-pie-chart) * [How to add picture to the chart and assign hyperlink](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#add-picture-to-chart-and-assign-hyperlink) * [How to customizing chart and chart elements](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#customizing-chart-and-chart-elements) -* [How to add data label to the chart](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#add-datatable-to-chart) \ No newline at end of file +* [How to add data label to the chart](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#add-datatable-to-chart)