gpt4 book ai didi

javascript - 在 excel4node 中填充 bgColor 单元格的示例

转载 作者:数据小太阳 更新时间:2023-10-29 04:27:29 24 4
gpt4 key购买 nike

我正在使用 excel4node 在 nodeJS 中创建 Excel 文件。该站点提供了以下使用填充属性的指南。

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, i.e. '2172d7aa'.
// bgColor: 'ffffff' // bgColor only applies on patternTypes other than solid.
}

请注意,单元格的背景色将是填充属性的前景色 (fgColor)。这听起来令人困惑,但当您了解 fill 属性具有使用不止一种颜色的图案,因此该属性具有前景色 背景色时,这就有意义了。

'solid' patternType 可能是您正在寻找的,但还有其他的,例如'darkDown'、'darkHorizo​​ntal'、'lightGrid' 等,如下所示: excel4node/fillPattern.js

关于javascript - 在 excel4node 中填充 bgColor 单元格的示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43118853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com