ExportAsFixedFormat call kills word

N

NickP

Hi there,

I am calling ExportAsFixedFormat on Word when the PDF export add-in is
*not* installed and it just kills Word,

---

VARIANT pVarOutputFileName; pVarOutputFileName.vt = VT_BSTR;
pVarOutputFileName.bstrVal =
cDPPPrinter->getOutputFileName().AllocSysString();
VARIANT_BOOL pVarOpenAfterExit = FALSE;
VARIANT_BOOL pVarIncludeDocProps = FALSE;
VARIANT_BOOL pVarDocStructureTags = FALSE;
VARIANT_BOOL pVarBitmapMissingFonts = TRUE;
VARIANT_BOOL pVarUseISO = FALSE;
pBlnUsedInternalPDFOutput =
(S_OK==pDPrDocument->ExportAsFixedFormat(pVarOutputFileName.bstrVal,
Word::wdExportFormatPDF, pVarOpenAfterExit,
Word::wdExportOptimizeForOnScreen, Word::wdExportAllDocument, 1, pLngCount,
Word::wdExportDocumentContent, pVarIncludeDocProps, FALSE,
Word::wdExportCreateWordBookmarks, pVarDocStructureTags,
pVarBitmapMissingFonts, pVarUseISO));

---

If I wrap this in a Try Catch block, it still crashes. Basically Word
dies instantly and terminates.

So first question is, this shouldn't be happening right? I know the
parameters I am passing appear to be valid, and secondly, why doesn't my Try
Catch block actually catch anything?

If I install the Add-In, the call works perfectly, and returns S_OK.
But as I have fallback code incase it is missing, I would rather the crash
didn't occur in the first place.

Any ideas?

Thanks in advance.

Nick.
 
N

NickP

Fixed, FYI

HKEY_CLASSES_ROOT\Installer\Components\12B306B24E250DD428FC7016B6FB4BD8

Check for that key before making the call, to ensure that the pdf / xps
component has been installed.
 

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