how to access programmatically to “print preview and print” page in Office Word 2010

血红的双手。 提交于 2019-12-24 05:57:10

问题


I am writing a medical program (with C# Language) which has a relation with Microsoft Office Word 2010. In Word 2010 there is a page "Print Preview and Print" which you can access by pressing Ctrl+P. After I launch Office Word, I want to see "Print Preview and Print" but instead I see the old print preview from Office 2007/2003, which means I don't know how to access this page from office com objects.

The code I've tried:

oWordDoc.PrintPreview();
_oWord.Visible = true;

回答1:


You can always try SendKeys to do the same as the hotkey CTRL+P

SendKeys.Send("^P");



回答2:


Try

int dialogResult = wordApp.Dialogs[Word.WdWordDialog.wdDialogFilePrint].Show(ref missing);
if (dialogResult == 1)
{
    oWordDoc.PrintOut(ref missing, ref missing, ref missing, ref missing,
                      ref missing, ref missing, ref missing, ref missing,
                      ref missing, ref missing, ref missing, ref missing,
                      ref missing, ref missing, ref missing, ref missing,
                      ref missing, ref missing);
}


来源:https://stackoverflow.com/questions/13365007/how-to-access-programmatically-to-print-preview-and-print-page-in-office-word

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!