Tag: cells

为什么设置一个单元格的颜色不起作用(Aspose Cells)?

我有这个代码来尝试设置一个单元格的背景颜色(除其他外): 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); 水平和垂直alignment工作的设置,如大胆和高度 – 除了颜色之外, 还需要什么? 我甚至尝试设置ForegroundColor以及背景颜色,以: style.ForegroundColor = Color.Red; style.BackgroundColor = Color.Blue; …但都没有做任何事情 – 单元格看起来和上面的截图完全一样。

Excel VBA – 使用.cells属性错误将范围分配给变体,

我有下面的代码提取下面, Dim profileRange as Variant profileRange = ActiveWorkbook.Worksheets("Scenario").Range(Cells(1, "C"), Cells(5, "C")) 然后在expression式中得到以下内容 Watch Expression: profileRange Value: Empty Type: Variant/Empty 它应该得到在该表中分配的数字…从1到5 另外,我在运行代码时得到了这个 Error 1004: Application or Object defined error 有人可以帮忙吗?

EPPLUS清除一系列单元格的内容

我想用EPPLUS来清除一系列的细胞。 我尝试了下面的语法,但它给了我一个错误 你调用的对象是空的 用EPPLUS清除细胞A24:C36内容的正确方法是什么? ExcelPackage package = new ExcelPackage(); ExcelWorksheet ws = package.Workbook.Worksheets["Sheet1"]; ws.Cells["A24:C36"].Clear();