Aspose.cells python via net 单元格颜色设置失效

target_cell: Cell = cell_sheet.cells.get(
head_cell.row + idx + 1, head_cell.column
)
self.frame_grid.add_comment(
cell_sheet, target_cell.name,
notes=['Data Valideer: ', *val]
)
target_style: Style = target_cell.get_style()
target_style.background_color = Color.red
target_cell.set_style(target_style)

@zengweiyu,

请使用带有实心图案的前景色来设置单元格底纹颜色。请参阅示例代码段以供参考。

#  Define a Style and get the A1 cell style
style = worksheet.cells.get("A1").get_style()
#  Setting the foreground color to yellow
style.foreground_color = Color.red
#  Setting the background pattern to vertical stripe
style.pattern = BackgroundType.SOLID
#  Apply the style to A1 cell
worksheet.cells.get("A1").set_style(style)

另请参阅文档以供参考。
https://docs.aspose.com/cells/python-net/cells-fill-settings/#setting-colors-and-background-patterns