none
PowerPoint Automation and Saving as HTML RRS feed

  • Question

  • 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.
    • Moved by Tony Chen CHN Tuesday, August 27, 2013 9:20 AM coding related
    Monday, August 26, 2013 4:11 PM

All replies

  • Hi

    This is the forum to discuss questions and feedback for Microsoft Office, better to post your question to the forum below:

    http://social.msdn.microsoft.com/Forums/office/en-us/home?category=officedev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thank you for your understanding.

    Tylor Wang
    TechNet Community Support

    Tuesday, August 27, 2013 9:36 AM