none
PowerPoint Automation and Saving as HTML

    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.



    Wednesday, August 28, 2013 6:38 PM

All replies

  • Hi,

    Thank you for posting in the MSDN Forum.
    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.
    Sorry for any inconvenience and have a nice day!
    Best regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 30, 2013 6:57 AM
  • Hi,

    Presentation.WebOptions property is deprecated in PowerPoint 2013.

    Regards

    Pradip

    Thursday, September 12, 2013 12:02 AM
  • Thank you for your reply.

    "Deprecated" suggests that it is something to avoid now (in 2013) since it may be removed in the future.

    In my code fragment, WebOptions is queried but its result is ignored.  SaveCopyAs() is later called with an HTML argument.  I'm also curious about this.

    Thursday, September 12, 2013 6:41 PM