问题描述
其中xlWs是Excel.Worksheet,xlRG是Excel.Range
xlRG = xlWS.Cells(row,7)
xlRG.Font.Bold = True
xlRG.Font.Color = 255
在VB6中你可以简单地说xlRG.Font.Color = vbRed但是在.net那里
不是常量vbRed,Color.Red给出的格式无效。是否有一套
枚举颜色可以在这里使用?
Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7)
xlRG.Font.Bold = True
xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there
is no constant vbRed and Color.Red gives an invalid format. Is there a set of
enumerations of colors that will work here?
推荐答案
Excel-Workbook:
xlWB.Colors(1)= RGB(255,255,255)
xlWB.Colors(2)= RGB(225,225,225)
xlWB.Colors(3)= RGB(200,200,200)
Excel-工作表
xlWS.Range(" A1:A30")。Interior.ColorIndex = 1
xlWS.Range(" B1:B30")。Interior.ColorIndex = 2
xlWS.Range(" C1:C30")。Interior.ColorIndex = 3
这对我来说很好用
Frank
Excel-Workbook:
xlWB.Colors(1) = RGB(255,255,255)
xlWB.Colors(2) = RGB(225,225,225)
xlWB.Colors(3) = RGB(200,200,200)
Excel-Worksheet
xlWS.Range("A1:A30").Interior.ColorIndex = 1
xlWS.Range("B1:B30").Interior.ColorIndex = 2
xlWS.Range("C1:C30").Interior.ColorIndex = 3
This works fine for me
Frank
嗨Darrell,
什么是确切的消息?可能是铸造问题。
TTH,
Adel A. Al-saleh
Hi Darrell,
What was the exact message? May it is a casting problem.
TTH,
Adel A. Al-saleh
这篇关于如何在EXCEL单元格中设置字体颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!