ExportAsFixedFormat gives HRESULT : 0x80020006 (DISP_E_UNKNOWNNAME)

Apr 18, 2012 at 12:35 PM
Edited Apr 18, 2012 at 12:36 PM

Hello Sebastian,

 

I'm trying to export a doc file into xps format with ExportAsFixedFormat but all the time I've this error Message:"ExportAsFixedFormat gives HRESULT : 0x80020006 (DISP_E_UNKNOWNNAME)"

 

dim wordApplication as new Word.Application
dim p_newDocument as Word.Document

p_newDocument= wordApplication.Documents.Open("c:\Fichier.doc")
p_newDocument.ExportAsFixedFormat("c:\fichier.xps", WdExportFormat.wdExportFormatXPS, False)

 

Do you have an idea why ?

Thanks in advance !

 

Johnny

Ps: NetOffice helps me a lot to generate quickly some word reports ! Thanks :)

Coordinator
Apr 18, 2012 at 12:49 PM

Hello Johnny

Have a look on the IntelliSense text. you see ExportAsFixedFormat is supported from Word 12 / 14 (2007 and 2010)
do you use a previous version or have multiple versions installed?

Sebastian

Apr 18, 2012 at 12:59 PM

Hello Sebastian,

 

Unfortunately, I've only Word 2003 installed; sorry I've not seen the information of the IntelliSence...

Maybe another solution will be to use the virtual XPS printer installed on the computer ? Is it possible to print on this printer "Microsoft XPS Document Writer" and give a filename ?

Thanks Sebastian :)

 

John

Coordinator
Apr 18, 2012 at 1:08 PM

Hello John,

For IntelliSence support you need the XML documentation file in the same directory as the netoffice assemblies. WordApi.xml -> WordApi.dll
You can accessing a registered Printer in .NET of course. The easiest way is the PrintDocument class from Windows.Forms namespace.

Sebastian