SOL9 Sample: PptToRtfApplet

SOL9 Samples

1 Screenshot


2 Source code

/*
 * PptToRtfApplet.cpp 
 * Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// 2010/04/09

#include <sol/office/PowerPointApplet.h>
#include <sol/office/PowerPointPresentation.h>

#include <sol/BString.h>

void _tmain(int argc, TCHAR** argv)
{
    if (argc !=2) {
        printf("Usage:PptToRtfApplet.exe PPTFullPath\n");
        return;
    }

    try {
        BString docname = argv[1];//"C:\\sample\\sample.ppt";
        PowerPointApplet applet;
        try {
            PowerPointPresentation presen = applet.open((BSTR)docname, true);
            printf("Opened a presentation %S\n", (BSTR)docname);

            BString rtfFile = docname + ".rtf";
            _bstr_t newfilename = (BSTR)rtfFile;

            presen.saveAs(newfilename, PowerPoint::ppSaveAsRTF);
            printf("Saved As %S\n", (BSTR)newfilename);

            presen.close();
            printf("Closed a presentation\n");
        } catch (HRESULT hr) {
            printf("Exception %x\n", hr);                        
        } catch (...) {
            printf("Unknown Exception\n");                        
        }

    } catch (HRESULT hr) {
        printf("Exception %x\n", hr);                        
    } catch (...) {
        printf("Unknown Exception\n");                        
    }
}


Last modified: 9 Apr 2010

Copyright (c) 2010 Antillia.com ALL RIGHTS RESERVED.