如何在VC中更改PPT的背景色,字体颜色,字体

nxl04 2009-08-21 05:21:55
_Application app;
Presentations presentations;
_Presentation presentation;
Slides slides;
_Slide slide;
ShapeRange shaperange;
Shapes shapes;
Shape shape;
TextFrame textframe;
TextRange textrange;
Font font;
FillFormat fillformat;
ColorFormat colorformat;
ShadowFormat shadow;

if(!app.CreateDispatch("Powerpoint.Application", &e))
{
CString str;
str.Format("CreateDispatch() failed w/err 0x%08lx", e.m_sc),
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
app.SetVisible(TRUE); Presentations presSet(app.GetPresentations());
_Presentation pres(presSet.Add(TRUE));

Slides slideSet(pres.GetSlides());
_Slide slide1(slideSet.Add(1, 2));

// Add text to slide, by navigating the slide as follows:
// slide1.shapes(#).TextFrame.TextRange.Text
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)1)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("My first slide");
}
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)2)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("Automating PowerPoint is easy\r\n"
"Using Visual C++ is powerful!我是中国人");
font = textrange.GetFont();
font.SetName("华文行楷"); //Set the font name.
font.SetSize((float)48);
}
现在字体的大小、加粗,斜体属性都可以改,但就是字体的颜色改不了,还有,写的东西英文是华文行楷,汉语就不是,是默认的宋体,不知为什么! 请高手赐教!!
...全文
831 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
PageLee 2009-12-12
  • 打赏
  • 举报
回复
ColorFormat m_clrFormat = font.GetColor();
//colorFormat里面有一个设置颜色的函数,我忘了,假如是SetColor();你可以看看
m_clrFormat.SetColor(RGB(255,255,255))
哈利路亚1874 2009-12-10
  • 打赏
  • 举报
回复
得到你对象的指针,调用SetFont成员函数就可以了
哈利路亚1874 2009-12-10
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 nxl04 的回复:]
哎,听说CSDN强人很多的嘛,我第一次发帖,应该高手露一下嘛
[/Quote]
怎么能这么说呢,高手无处不在!^_^
CFont * f;
f = new CFont;
f->CreateFont(12, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_DONTCARE, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("宋体")); // lpszFac
PageLee 2009-12-10
  • 打赏
  • 举报
回复
用powerpoint 2007不用设置字体颜色,原来是什么,就是什么
nxl04 2009-08-24
  • 打赏
  • 举报
回复
哎,听说CSDN强人很多的嘛,我第一次发帖,应该高手露一下嘛
nxl04 2009-08-24
  • 打赏
  • 举报
回复
请各位赐教。
nxl04 2009-08-24
  • 打赏
  • 举报
回复
难道没人会吗
hhwei1985 2009-08-21
  • 打赏
  • 举报
回复
sf

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧