From cc222cd68ef709edd87fb770b305c645a8fc2c5f Mon Sep 17 00:00:00 2001 From: VinothSF5015 Date: Tue, 14 Apr 2026 00:31:26 +0530 Subject: [PATCH 1/3] 1007137 - Content Added --- Document-Processing-toc.html | 3 + ...t-invert-if-negative-option-for-a-chart.md | 76 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index e98d61bfb..e2fbe052a 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -6641,6 +6641,9 @@
  • How to retrieve the name of the chart in an Excel worksheet?
  • +
  • + How to set invert if negative option for a chart using XLsIO? +
  • diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md new file mode 100644 index 000000000..e9aeb8853 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md @@ -0,0 +1,76 @@ +--- +title: Setting Invert If negative option in Chart properties using Syncfusion XLsIO | Syncfusion +description: This page tells how to set invert if negative option for a chart. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to set invert if negative option for a chart using XLsIO? + +This following code samples demonstrate how to set invert if negative option for a chart using C# (Cross-platform and Windows-specific) and VB.NET. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + #region Workbook Initialization + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); + IWorksheet worksheet = workbook.Worksheets[0]; + #endregion + + IChart chart = worksheet.Charts[0]; + + //Used to invert series color if the value is negative + (chart.Series[0] as ChartSerieImpl).InvertIfNegative = true; + + #region Save + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); + #endregion +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + #region Workbook Initialization + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open("InputTemplate.xlsx"); + IWorksheet worksheet = workbook.Worksheets[0]; + #endregion + + IChart chart = worksheet.Charts[0]; + + //Used to invert series color if the value is negative + (chart.Series[0] as ChartSerieImpl).InvertIfNegative = true; + + #region Save + //Saving the workbook + workbook.SaveAs("Output.xlsx"); + #endregion +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx") + Dim worksheet As IWorksheet = workbook.Worksheets(0) + + Dim chart As IChart = worksheet.Charts(0) + + 'Used to invert series color if the value is negative + DirectCast(chart.Series(0), ChartSerieImpl).InvertIfNegative = True + + 'Saving the workbook + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example in C# is present on this GitHub page. \ No newline at end of file From 5e66075bc2bf509b7ac1662a0c52e7cf900d816e Mon Sep 17 00:00:00 2001 From: VinothSF5015 Date: Tue, 14 Apr 2026 10:32:38 +0530 Subject: [PATCH 2/3] Update how-to-set-invert-if-negative-option-for-a-chart.md --- .../how-to-set-invert-if-negative-option-for-a-chart.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md index e9aeb8853..5d8a2c929 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md @@ -1,6 +1,6 @@ --- -title: Setting Invert If negative option in Chart properties using Syncfusion XLsIO | Syncfusion -description: This page tells how to set invert if negative option for a chart. +title: Setting Invert If negative option in Chart properties | Syncfusion +description: This page tells how to set invert if negative option for a chart using Syncfusion XlsIO in C# (Cross-platform and Windows-specific) and VB.NET. platform: document-processing control: XlsIO documentation: UG @@ -73,4 +73,4 @@ End Using {% endhighlight %} {% endtabs %} -A complete working example in C# is present on this GitHub page. \ No newline at end of file +A complete working example in C# is present on this GitHub page. From 5cf9389da91ad87d0d4a42dab2d17e1822308aef Mon Sep 17 00:00:00 2001 From: VinothSF5015 Date: Tue, 14 Apr 2026 11:17:36 +0530 Subject: [PATCH 3/3] Update how-to-set-invert-if-negative-option-for-a-chart.md --- .../faqs/how-to-set-invert-if-negative-option-for-a-chart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md index 5d8a2c929..c706c3b63 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-invert-if-negative-option-for-a-chart.md @@ -6,7 +6,7 @@ control: XlsIO documentation: UG --- -# How to set invert if negative option for a chart using XLsIO? +# How to set invert if negative option for a chart using XlsIO? This following code samples demonstrate how to set invert if negative option for a chart using C# (Cross-platform and Windows-specific) and VB.NET.