From 7fd6c3b972eb4825a71498cd1a7edfb506e913c4 Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Wed, 29 Oct 2025 13:35:21 +0530 Subject: [PATCH 1/3] 988098-Column-Color --- .../NET/faqs/how-to-get-the-column-color.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md new file mode 100644 index 000000000..d6deb7f46 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md @@ -0,0 +1,58 @@ +--- +title: How to get the column color | Syncfusion. +description: This page explains how to get the styled column color when column cells have different colors in an Excel document using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to get the styled column color when column cells have different colors? + +According to Microsoft Excel behavior, when a column's cells have different fill colors, the column color property returns an empty value. Syncfusion XlsIO mirrors this behavior, as Excel doesn't set a unified column color in such cases. This can lead to issues when trying to retrieve color using column cell style properties. +The following code example illustrates how to get the column color when column cells have different colors in an 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.Open("Column styles.xlsx", ExcelOpenType.Automatic); + + IWorksheet worksheet = workbook.Worksheets[0]; + + ExtendedFormatImpl format = (workbook as WorkbookImpl).InnerExtFormats[(worksheet["A1"] as RangeImpl).ExtendedFormatIndex]; + Color color = format.Color; +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + IWorkbook workbook = application.Workbooks.Open("Column styles.xlsx", ExcelOpenType.Automatic); + + IWorksheet worksheet = workbook.Worksheets[0]; + + ExtendedFormatImpl format = (workbook as WorkbookImpl).InnerExtFormats[(worksheet["A1"] as RangeImpl).ExtendedFormatIndex]; + Color color = format.Color; +} +{% 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("Column styles.xlsx", ExcelOpenType.Automatic) + Dim worksheet As IWorksheet = workbook.Worksheets(0) + + Dim format As ExtendedFormatImpl = DirectCast(workbook, WorkbookImpl).InnerExtFormats(DirectCast(worksheet("A1"), RangeImpl).ExtendedFormatIndex) + Dim color As Color = format.Color + +End Using +{% endhighlight %} +{% endtabs %} \ No newline at end of file From 499c164ac0b92b354422e40b15bd4d3e462da94c Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Wed, 29 Oct 2025 18:08:49 +0530 Subject: [PATCH 2/3] 988098-Column-Color --- .../Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md index d6deb7f46..011769a42 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-color.md @@ -6,7 +6,7 @@ control: XlsIO documentation: UG --- -# How to get the styled column color when column cells have different colors? +# How to get the column color when column cells have different colors? According to Microsoft Excel behavior, when a column's cells have different fill colors, the column color property returns an empty value. Syncfusion XlsIO mirrors this behavior, as Excel doesn't set a unified column color in such cases. This can lead to issues when trying to retrieve color using column cell style properties. The following code example illustrates how to get the column color when column cells have different colors in an Excel document. From 8527854bb9e8855e945cc9ed53f3f7d2a19e3374 Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Wed, 5 Nov 2025 19:43:51 +0530 Subject: [PATCH 3/3] 988098-Column-Color --- Document-Processing-toc.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 6475d96d8..ad802cb60 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -5857,6 +5857,9 @@
  • What ExcelKnownColors are available in Syncfusion XlsIO?
  • +
  • + How to get the column color when column cells have different colors? +