我现在已经可以用VC控制PowerPoint的调用、显示、插入文本、分页等功能,但就是找不到用什么方法可以改变PPT的背景色与字体颜色。
  小弟已经研究一天了还是没有办法,请在场的VC高手们指教一下,比如应该用到哪些类、类中的哪些方法等等。
  最好有实例说明,小弟比较笨:)
  在线等,急!!
             多谢了!!

解决方案 »

  1.   

    多谢上面楼主的指点,我现在已经能改变PPT的背景色了,但现在SLIDE的字体颜色还是改不了,简略程序如下:
    _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("Comic Sans MS"); //Set the font name.
    font.SetSize((float)48);
    }
    现在字体的大小、名称等属性都可以改,但就是字体的颜色改不了,不知为什么!
          请大家帮小弟看看,小弟不胜感激!!
                 多谢了!!