如下代码:
void CAbaoRange::SetBackgroundColor(long color)
{
Interior it;
it.AttachDispatch(rg.GetInterior());
it.SetColorIndex(COleVariant(color));//标题底色
}
其中Interior是设置单元格的颜色的,在添加类的时候要将Interior选上才能使用Interior类,color是值,从1~56(超过57会出现问题),从1到56的对应的颜色,如下图所示: