全屏模式下获取数据
GetTitleNameWithSlide(strTitleName,m_spApp.p->ActivePresentation->SlideShowWindow->View->Slide);
BOOL MyPptTest::GetTitleNameWithSlide(char *sOutTitleName, _SlidePtr Sld)
{
char strTmp[256] = {0};
int nIndex = Sld->GetSlideIndex(); //当前第几页
int ncount = 0; //本页总共有几个对象,对象ID从1开始,包括所有对象
MSPPT::Shapes* pShapes = NULL;
Sld->get_Shapes(&pShapes);
ncount = pShapes->GetCount();
if (pShapes)
{
int i = 0;
BOOL bIsHave = FALSE;
MSPPT::Shape *pItemFrist = NULL;
int nMinIndex = 1;
for (i = 1;i <=ncount;i++)
{
MSPPT::Shape *pItem1 = NULL;
pShapes->raw_Item(_variant_t((long)i),&pItem1);
Office::MsoShapeType shapeType ;
pItem1->get_Type(&shapeType);
if (shapeType != msoPlaceholder &&
shapeType != msoAutoShape &&
shapeType != msoTextBox &&
shapeType != msoFreeform )
{
//PPT页面中对象类型不为上述类型的时候,执行下面的一些函数的时候造成ppt内部崩溃,其他变量需要进一步测试
continue;
}
pShapes->raw_Item(_variant_t((long)i),&pItemFrist);
MSPPT::TextFrame *pTextframe = NULL;
pItemFrist->get_TextFrame(&pTextframe);
if (pTextframe)
{
MSPPT::TextRange* pRange = NULL;
pTextframe->get_TextRange(&pRange);
char szText[255];
BSTR bstrText = NULL;
pRange->get_Text(&bstrText); //bstrText就是ppt当前页的各个可读取对象的文本内容
}
}
}
return TRUE;
}
//非全屏模式下获取ppt当前页内容只是函数传入变量不同而已,其他都一样
struct SlideRange *Sldrange=(struct SlideRange *)lpStru;
GetTitleNameWithSlideRange(Sldrange);