I am using excel4node to create Excel file in nodeJS. The site gives following guideline to use fill property.
fill: { // §18.8.20 fill (Fill)
type: string, // Currently only 'pattern' is implimented. Non- implimented option is 'gradient'
patternType: string, //§18.18.55 ST_PatternType (Pattern Type)
bgColor: string // HTML style hex value. optional. defaults to black
fgColor: string // HTML style hex value. required.
},
I could not work around this. Anyone can help me, please?
A subset of conditional formatting features is currently supported by excel4node. Formatting rules apply at the worksheet level. The only conditional formatting type that is currently supported is expression. When the formula returns zero, conditional formatting is NOT displayed.
A full featured xlsx file generation library allowing for the creation of advanced Excel files. excel4node conforms to the ECMA-376 OOXML specification 2nd edition An instance of the Workbook class contains all data and parameters for the Excel Workbook. Workbook constructor accepts an optional configuration object.
excel4node conforms to the ECMA-376 OOXML specification 2nd edition An instance of the Workbook class contains all data and parameters for the Excel Workbook.
Basically what you can do with the package in its current state is the following:
fill: {
type: 'pattern', // the only one implemented so far.
patternType: 'solid', // most common.
fgColor: '2172d7', // you can add two extra characters to serve as alpha, i.e. '2172d7aa'.
// bgColor: 'ffffff' // bgColor only applies on patternTypes other than solid.
}
Note that the background color of your cell will be the foreground color (fgColor) of the fill property. It sounds confusing, but it makes sense when you understand that the fill property have patterns that use more than one color, hence the property having foreground and background colors.
The 'solid' patternType is probably what you're looking for, but there are others, such as 'darkDown', 'darkHorizontal', 'lightGrid', and etc, as can be seen here: excel4node/fillPattern.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With