Office 2007, ExportAsFixedFormat, Save word document as PDF

G

Gustav Corne

Hi I am having trouble with saving my word document as PDF using c# and
word.

I get an error:
- ex {"The parameter is incorrect." } System.Exception

StackTrace " at
Microsoft.Office.Interop.Word.DocumentClass.ExportAsFixedFormat(String
OutputFileName, WdExportFormat ExportFormat, Boolean OpenAfterExport,
WdExportOptimizeFor OptimizeFor, WdExportRange Range, Int32 From, Int32 To,
WdExportItem Item, Boolean IncludeDocProps, Boolean KeepIRM,
WdExportCreateBookmarks CreateBookmarks, Boolean DocStructureTags, Boolean
BitmapMissingFonts, Boolean UseISO19005_1, Object
FixedFormatExtClassPtr)\r\n at WordReplace.Form1.button1_Click(Object
sender, EventArgs e) in c:\\documents and settings\\gcorne\\my
documents\\visual studio projects\\wordtest\\wordreplace\\form1.cs:line 128"
string

I guess it has something todo with the last parameter that should be a
"System.Object FixedFormatExtClassPtr" and I havn't got a clue what should
be there, now I try to pass a System.Reflection.Missing.Value.

Anyone know what to do?

/Gustav

aDoc.ExportAsFixedFormat(saveFile,
Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF, false,
Microsoft.Office.Interop.Word.WdExportOptimizeFor.wdExportOptimizeForPrint,
Microsoft.Office.Interop.Word.WdExportRange.wdExportAllDocument, 1, 1,
Microsoft.Office.Interop.Word.WdExportItem.wdExportDocumentContent,
false, true,
Microsoft.Office.Interop.Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks,
false, true, true, missing);
aDoc.Close(ref saveChanges, ref missing, ref missing );
/*
public abstract new void ExportAsFixedFormat ( System.String
OutputFileName , Microsoft.Office.Interop.Word.WdExportFormat ExportFormat ,
System.Boolean OpenAfterExport ,
Microsoft.Office.Interop.Word.WdExportOptimizeFor OptimizeFor ,

Microsoft.Office.Interop.Word.WdExportRange Range , System.Int32 From ,
System.Int32 To ,
Microsoft.Office.Interop.Word.WdExportItem Item , System.Boolean
IncludeDocProps ,
System.Boolean KeepIRM ,
Microsoft.Office.Interop.Word.WdExportCreateBookmarks CreateBookmarks ,

System.Boolean DocStructureTags , System.Boolean BitmapMissingFonts ,
System.Boolean UseISO19005_1 , System.Object FixedFormatExtClassPtr )

*/
 
C

Cindy M.

Hi Gustav,
I am having trouble with saving my word document as PDF using c# and
word.
I wouldn't worry too much about it, or even consider building a
solution around this feature. Remember, this is beta software, so 1.
Some things won't work and 2. Things can change.

Last I heard, Adobe and Microsoft still hadn't come to an agreement
about MS being allowed to include this as part of the distributed Word
package, and the capability will not be in the final product. Instead,
the PDF converter may be made available as a download. No idea, yet,
what this will mean for the object model...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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