-
As far as I can tell, cell can only be colored using predefined From the available methods / properties,
only
color, but I simply couldn't figure out yet how to assign this either to an existing cell style or to a brand new one. All the articles I could find also only use Am I missing something obvious or this is indeed not possible? The meaning of the terms "foreground" and "background" in this context is also misleading, but that is inherited from Apache POI, and it is well documented online (again, here and here, for example). edit: Found two other solutions for C# (this and this), that do the obvious by setting
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I failed to notice that a cell's Also, here's a summary of which property does what, quoting from this answer:
In my case, I need
To use it:
|
Beta Was this translation helpful? Give feedback.
I failed to notice that a cell's
CellStyle
property returns the genericICellStyle
, which has to be cast down toNPOI.XSSF.UserModel.XSSFCellStyle
in order to gain access to theFillBackgroundXSSFColor
andFillForegroundXSSFColor
properties.Also, here's a summary of which property does what, quoting from this answer:
In my case, I need
NPOI.SS.UserModel.Fi…