Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

PowerPoint Automation and Saving as HTML

$
0
0

Up until Office 2010, our application could save a PPT or PPTX file as HTML from C/C++ code.  With 2013, this is failing:

int saveAsHTML(CComPtr<PowerPoint::_Presentation> presentation, TCHAR *destDir, TCHAR *imagePrefix)
{
    CComPtr<PowerPoint::WebOptions> webOptions;
    HRESULT hr = presentation->get_WebOptions(&webOptions);
    TCHAR slideName[256];
    swprintf(slideName, _T("%s%s%s.htm"), destDir, SEPARATOR, imagePrefix);
    // Save copy of file.            
    BSTR szSlideName = T2BSTR(slideName);
    hr = presentation->SaveCopyAs((BSTR)szSlideName, ppSaveAsHTML, msoFalse);
    SysFreeString(szSlideName);
    if (hr != S_OK) return 1;            
    return 0;
}

The above code works in PowerPoint 2007 & PowerPoint 2010.

This is an abbreviated but still tested piece of code from our product.

In 2013, the above call to get_WebOptions() is returning NULL while in previous versions it was not.  If the return is NULL, the function would have immediately returned with an error.

The call to SaveCopyAs() is given a parameter for saving as HTML.  The return value is FFFFFFFF80048240.  I have looked this up and found this MS Support KB number 285472.  (I'd include the link but I don't want my posting delayed while my account is verified.)

The error code is specific to PowerPoint.  The workaround mentions making the following call:

PowerPoint.Application.Visible = msoTrue

I found this interesting since PowerPoint is visible.  I also found it interesting that our code has already been making this call:

CComPtr<PowerPoint::_Application> objApp; HRESULT hr; hr = ::CoCreateInstance( __uuidof(PowerPoint::Application), NULL, CLSCTX_LOCAL_SERVER, __uuidof(PowerPoint::_Application), (void**) &objApp); if (hr != S_OK) { errorOut(_T("CoCreateInstance"), hr, objApp, NULL); return 1; } objApp->put_Visible(msoTrue);

I'd like to know if this is an existing issue with 2013, whether saving as HTML is still supported or if there are any work arounds.




Viewing all articles
Browse latest Browse all 2257

Trending Articles