在excel4node中填充bgColor单元格的示例
我正在使用excel4node在nodeJS中创buildExcel文件。 该网站提供以下指导使用填充属性。
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. },
我无法解决这个问题。 任何人都可以帮助我吗?
基本上你可以用当前状态下的软件包做以下事情:
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, ie '2172d7aa'. // bgColor: 'ffffff' // bgColor only applies on patternTypes other than solid. }
请注意,您的单元格的背景颜色将是fill属性的前景色(fgColor)。 这听起来令人困惑,但是当您了解fill属性具有使用多种颜色的模式时,这是有意义的,因此该属性具有前景和背景颜色。
'solid'patternType可能是你正在寻找的,但是也有其他的,比如'darkDown','darkHorizontal','lightGrid'等,如下所示: excel4node / fillPattern.js