Excel操作——单元格的字体和对齐方式

字体的属性包括:名称,大小,颜色,颜色索引,加粗,倾斜,下划线等等。这里只说明前四个,后面的与前四个基本相同。
获得名称,大小,颜色和颜色索引等四个属性。
oCurCell.AttachDispatch(m_oCurrRange.GetItem(COleVariant( (long)(i+ 1)),COleVariant( (long)j) ).pdispVal,TRUE);
FontoFont;
oFont=oCurCell.GetFont();
VARIANTvarName=oFont.GetName();
VARIANTvarSize=oFont.GetSize();
VARIANTvarColor=oFont.GetColor();
VARIANTvarColorIndex=oFont.GetColorIndex();
获得水平和垂直对齐方式
VARIANTvarHor=oCurCell.GetHorizontalAlignment();
VARIANTvarVer=oCurCell.GetVerticalAlignment();
设置名称,大小,颜色和颜色索引等四个属性
oCurCell.AttachDispatch(m_oCurrRange.GetItem(COleVariant( (long)(i+ 1)),COleVariant( (long)j) ).pdispVal,TRUE);
FontoFont;
oFont=oCurCell.GetFont();
oFont.PutName(varName);
oFont.PutSize(varSize);
oFont.PutColor(varColor);
oFont.PutColorIndex(varColorIndex);
设置水平和垂直对齐方式
oCurCell.PutHorizontalAlignment(varHor);
oCurCell.PutVerticalAlignment(varVer);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值