views:

1221

answers:

1

Hey All!

I'm trying to print a word doc from my C# code. I used the 12.0.0.0 Word Interop and what i'm trying to do is to get a Print Dialogue pop up before the document prints. I'm not 100% sure of the syntax of all of this as I can't get my code to work :( Any ideas?

Thanks in advance!

A: 

It should be something along the lines of:

            object nullobj = Missing.Value;
            doc = wordApp.Documents.Open(ref file,
                                        ref nullobj, ref nullobj, ref nullobj,
                                        ref nullobj, ref nullobj, ref nullobj,
                                        ref nullobj, ref nullobj, ref nullobj,
                                        ref nullobj, ref nullobj, ref nullobj,
                                        ref nullobj, ref nullobj, ref nullobj);

            doc.Activate();
            doc.Visible = true;
            int dialogResult = wordApp.Dialogs[Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFilePrint].Show(ref nullobj);
            if (dialogResult == 1)
            {
                doc.PrintOut(ref nullobj, ref nullobj, ref nullobj, ref nullobj, 
                             ref nullobj, ref nullobj, ref nullobj, ref nullobj, 
                             ref nullobj, ref nullobj, ref nullobj, ref nullobj, 
                             ref nullobj, ref nullobj, ref nullobj, ref nullobj, 
                             ref nullobj, ref nullobj);
            }
McAden
for some reason this is not working...can you show me all your syntax? Even a simple print won't work for me!!!
Are you saying it won't print, or that the dialog won't show up?
McAden