【发布时间】:2016-11-23 16:38:55
【问题描述】:
我有这段代码可以尝试设置单元格的背景颜色(除其他外):
private static readonly Color CONTRACT_ITEM_COLOR = Color.FromArgb(255, 255, 204);
. . .
cell = pivotTableSheet.Cells[4, 0];
cell.PutValue(AnnualContractProductsLabel);
style = cell.GetStyle();
style.HorizontalAlignment = TextAlignmentType.Center;
style.VerticalAlignment = TextAlignmentType.Center;
style.Font.IsBold = true;
pivotTableSheet.Cells.SetRowHeight(4, 25);
style.BackgroundColor = CONTRACT_ITEM_COLOR;
pivotTableSheet.Cells[4, 0].SetStyle(style);
水平和垂直对齐的设置有效,粗体和高度也有效 - 除了颜色之外的所有内容:
还需要什么?我什至尝试将 ForegroundColor 和 Background 颜色设置为:
style.ForegroundColor = Color.Red;
style.BackgroundColor = Color.Blue;
...但两者都没有 - 单元格看起来仍然与上面的屏幕截图完全相同。
【问题讨论】:
标签: excel colors aspose aspose-cells background-foreground