You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: knowledge-base/retrieve-cell-color-radspreadprocessing.md
+7-12Lines changed: 7 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,22 +17,17 @@ ticketid: 1656165
17
17
18
18
## Description
19
19
20
-
I have imported an Excel file with some cells formatted with color. Is it possible for me to retrieve the cell color in my program? When the background color is set from MS Excel, my implementation does not retrieve the actual background color.
21
-
22
-
This KB article also answers the following questions:
23
-
- How can I get the background color of a cell in RadSpreadProcessing?
24
-
- How to handle cell colors that come from a document theme in RadSpreadProcessing?
25
-
- What is the method to extract the actual color value of a cell formatted in Excel through RadSpreadProcessing?
20
+
Let's import an Excel file with some cells formatted with color. Learn how to retrieve the cell color when the background color is set from MS Excel.
26
21
27
22
## Solution
28
23
29
24
To retrieve the cell color in RadSpreadProcessing, especially when the color is applied through the document theme, follow these steps:
30
25
31
-
1. Import the Excel document using the appropriate format provider.
32
-
2. Access the desired cell or range of cells.
33
-
3. Check if the cell's fill is of type `PatternFill`.
34
-
4. Retrieve the `ThemableColor` object from the `PatternFill`.
35
-
5. Use the `GetActualValue` method of the `ThemableColor` object, passing in the document's theme, to get the actual color value.
26
+
1.[Import the Excel document]({%slug radspreadprocessing-formats-and-conversion-xlsx-xlsxformatprovider%}) using the appropriate format provider.
27
+
2.[Access the desired cell]({%slug radspreadprocessing-working-with-cells-accessing-cells-of-worksheet%}) or range of cells.
28
+
3. Check if the cell's fill is of type [PatternFill](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/get-set-clear-properties#fill-property).
29
+
4. Retrieve the [ThemableColor]({%slug radspreadprocessing-features-styling-document-themes%}) object from the `PatternFill`.
30
+
5. Use the [GetActualValue](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/styling/document-themes#getting-actual-values) method of the `ThemableColor` object, passing in the document's theme, to get the actual color value.
36
31
37
32
Here is a sample code snippet demonstrating these steps:
38
33
@@ -66,7 +61,7 @@ This approach ensures that even when a cell's color is derived from the document
66
61
67
62
## See Also
68
63
69
-
-[Document Themes in RadSpreadProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/styling/document-themes)
64
+
-[Document Themes in RadSpreadProcessing]({%slug radspreadprocessing-features-styling-document-themes%}})
70
65
-[Getting Actual Values](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/styling/document-themes#getting-actual-values)
0 commit comments