none
How to use WdPrintOutItem.wdPrintDocumentWithMarkup before the Printout method call. RRS feed

  • Question

  • Hi

    There is any way to use WdPrintOutItem.wdPrintDocumentWithMarkup before the Printout call.

                     Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
                          wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
                          wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
                          PrintZoomColumn:=3, PrintZoomRow:=3, PrintZoomPaperWidth:=0, _
                          PrintZoomPaperHeight:=0

        and also without using below code.

                wdApp.Dialogs[Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFilePrint];
                object oDlg = dlg;
                object[] oArgs = { "Microsoft XPS Document Writer" };
                dlg.GetType().InvokeMember("Printer", BindingFlags.SetProperty, null, oDlg, oArgs);
                oArgs[0] = WdPrintOutItem.wdPrintDocumentWithMarkup;
                dlg.GetType().InvokeMember("Type", BindingFlags.SetProperty, null, oDlg, oArgs);
                dlg.GetType().InvokeMember("Execute", BindingFlags.InvokeMethod, null, oDlg, null);

    Thanks


    karthikeyan


    Wednesday, June 27, 2012 12:24 PM

Answers

  • Hi Karthikeyan,

    Please correct me if my interpretation of your request amounts to reaching into the IPrint::Print parameters to set the STGMEDIUM argument pstgmOption (assuming the enumeration of that includes one to include markups) which the PrintWhat dialog does so you don’t need to programmatically respond to the dialog.

    Your current solution appears to be the only way.

    Word has its own Print dialog and doesn’t expose the target of the PrintWhat dialog’s members.

    That doesn’t provide a way of programmatically short-cutting the PrintWhat so your code works instead.

    See - wdMarkupRectangleArea           of :

    WdRectangleType Enumeration (Microsoft.Office.Interop.Word)
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdrectangletype.aspx

    It still reflects what was set in the PrintWhat.

    If you have comments in a Word 2010 document and look at the Print settings dropdown on the Backstage Print tab there’s Document Properties list where you will see a Print Markup checkbox. The only way to programmatically manipulate the tabs in the Backstage is to Hide and deactivate one and substitute your own. If you did that you’d still need to know how to write a call into the PrintWhat of Word.


    Please remember to mark the replies as answer if they help and unmark them if they provide no help. and click "Vote as Helpful" this and other helpful posts, so other users will see your thread as useful. Best Regards, Chris Jensen

    Friday, June 29, 2012 10:10 PM
    Moderator

All replies

  • Hi karthikeyan,

    Thanks for posting in the MSDN Forum.

    As far as I know that wdPrintOutItem enum can only be used on those places which you mentioned in your post.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, June 28, 2012 4:42 AM
    Moderator
  • Hi,

    For Printing, i am using IPrint::Print() method

    IPrint *pPrint;pPrint->Print(PRINTFLAG_RECOMPOSETODEVICE|PRINTFLAG_FORCEPROPERTIES, &ptd, &ppgset, NULL,pCallback, 1, &cPages, &cLastPage);

    so i need to set the value "Document Showing Markup" in " Print What" print option before start printing the document.

    Thanks


    karthikeyan


    Thursday, June 28, 2012 6:26 AM
  • Hi Karthikeyan,

    Please correct me if my interpretation of your request amounts to reaching into the IPrint::Print parameters to set the STGMEDIUM argument pstgmOption (assuming the enumeration of that includes one to include markups) which the PrintWhat dialog does so you don’t need to programmatically respond to the dialog.

    Your current solution appears to be the only way.

    Word has its own Print dialog and doesn’t expose the target of the PrintWhat dialog’s members.

    That doesn’t provide a way of programmatically short-cutting the PrintWhat so your code works instead.

    See - wdMarkupRectangleArea           of :

    WdRectangleType Enumeration (Microsoft.Office.Interop.Word)
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdrectangletype.aspx

    It still reflects what was set in the PrintWhat.

    If you have comments in a Word 2010 document and look at the Print settings dropdown on the Backstage Print tab there’s Document Properties list where you will see a Print Markup checkbox. The only way to programmatically manipulate the tabs in the Backstage is to Hide and deactivate one and substitute your own. If you did that you’d still need to know how to write a call into the PrintWhat of Word.


    Please remember to mark the replies as answer if they help and unmark them if they provide no help. and click "Vote as Helpful" this and other helpful posts, so other users will see your thread as useful. Best Regards, Chris Jensen

    Friday, June 29, 2012 10:10 PM
    Moderator