5,138
社区成员
发帖
与我相关
我的任务
分享
TCHAR szFile[] = _T("C:\\Users\\Zhao Leo\\Desktop\\1.pptx");
_ApplicationPtr spApp;
spApp.CreateInstance(L"Powerpoint.Application");
PresentationsPtr spPresentations = spApp->GetPresentations();
_PresentationPtr spPresentation = spPresentations->Open(szFile, msoFalse, msoFalse, msoFalse);
SlidesPtr spSlides = spPresentation->GetSlides();
long nCnt = spSlides->GetCount();
_SlidePtr spSlide = spSlides->Item(static_cast<long>(1));
PowerPoint::ShapePtr spShape = spSlide->GetShapes()->Item(static_cast<long>(1));
PowerPoint::TextFramePtr spTextFrame = spShape->GetTextFrame();
string str = spTextFrame->GetTextRange()->Text;
PowerPoint::TextFrame2Ptr spTextFrame2 = spShape->GetTextFrame2();
MsoTriState bRet = spTextFrame2->HasText;
TextRange2Ptr spTextRange2 = spTextFrame2->GetTextRange();
string str2 = spTextRange2->Text;
spPresentation->Close();
0x00007FFD53E16892 (oleaut32.dll) (2016080303.exe 中)处有未经处理的异常: 0xC0000005: 执行位置 0x00007FFD53E16892 时发生访问冲突。
#pragma implementation_key(1676)
inline _bstr_t TextRange2::GetText ( ) {
BSTR _result = 0;
HRESULT _hr = get_Text(&_result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _bstr_t(_result, false);
}