PowerPoint 2007: activePresentation->ExportAsFixedFormat failed

P

Paul

Hi,

I am developing an application which uses office automation with Office
2007, which converts doc, xls and ppt files into pdf format. The application
is in C (long story), and uses the ExportAsFixedFormat method. This works
fine for Word and Excel, however I have a problem with Powerpoint which I
can't understand.

I have working code which uses the "SaveAs" method into HTML for all three
applications without issue, so I know the underlying dispatch/parameter
handling code is fine.

With PowerPoint, I keep getting 0x80020005 (type mismatch) as a result of
the ExportAsFixedFormat call. According to the object browser in PowerPoint,
and information from Microsoft, the ExportAsFixedFormat function requires two
arguments, the output filename and the FixedFormatType.

I can execute the following fine, from Visual Basic within a loaded
PowerPoint document:

Application.ActivePresentation.ExportAsFixedFormat "c:\work\zot.pdf",
ppFixedFormatTypePDF

Note, the constant is value 2, so the following also works:

Application.ActivePresentation.ExportAsFixedFormat "c:\work\zot.pdf", 2

In C, before calling the method, I prepare the arguments as follows:

VARIANTARG params[2];
VariantInit(&params[0]);
VariantInit(&params[1]);
params[0].vt = VT_I4;
params[0].lVal = 2;
params[1].vt = VT_BSTR;
params[1].bstrVal = targetFileBstr;

Note in C - the argument order has to be reversed (I've tried the other way
around and it makes no difference - same error).

My initial suspicion was the constant value "2" should be another type
instead of VT_I4, but after trying all other integer types, same result.

Does anyone have any ideas what might be wrong? Its frustrating to see that
this works in Word and Excel, and not PowerPoint.

Cheers.
 
P

Paul

Incidently, I can generate PDFs from PowerPoint from C using the "SaveAs"
method, however there are a number of PDF export options which I need to set,
which necessitates the use of "ExportAsFixedFormat". An example is the
PpPrintOutputType parameter, where I want to set it as
ppPrintOutputOneSlideHandouts.
 
G

gnome44

Hello,

I am developping in delphi 7 the same application ;)

I have exactly the same problem with powerpoint 2007 (while excel an
word work fine!)

I'm wondering if this method is supported by powerpoint automation?
Because the message 'type mismatch' seems to come from the automatio
object itself, and not from the method.


Oh yes your post is 04-11-2007, not so far.

If you have found any solution other than the saveAs one (it works als
in my application)...

Yes what is strange also in the msdn is the lack of Office 12 Objec
documentation for powerpoint...

Tschüss!
Guillaume.

PS : please do not bannish this post for my english..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top