_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);
}
现在字体的大小、加粗,斜体属性都可以改,但就是字体的颜色改不了,还有,写的东西英文是华文行楷,汉语就不是,是默认的宋体,不知为什么! 请高手赐教!!
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);
}
现在字体的大小、加粗,斜体属性都可以改,但就是字体的颜色改不了,还有,写的东西英文是华文行楷,汉语就不是,是默认的宋体,不知为什么! 请高手赐教!!
解决方案 »
- 初学ATL,如何快速形成整体概念?
- 谁开发过GPS车载定位系统相关的软件啊?求教
- 写了个动态链接库DLL, 用Client调用链接出问题,不解.请指教?
- 如何选中列表框中的文件名,获得文件路径阿?困扰了很久的问题
- 问个弱弱的问题,为什么flashget用多个连接速度会快?难道是服务器或客户端对每个连接有流量限制?
- 为什么我的程序总是无限制的接收到WM_PAINT消息啊?感觉像是死循环似的
- form怎么初始化
- DialogBar 和 视图的问题,求助????????
- 如何实现左右声道独立播放wav文件?
- 一个ISAPI程序的问题
- 为什么在MFC里找不到socket中关于Listen的定义
- cArray压入数据
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
//colorFormat里面有一个设置颜色的函数,我忘了,假如是SetColor();你可以看看
m_clrFormat.SetColor(RGB(255,255,255))