办公二千零十三分之二千零十Interop.Word打印预览对话框 [英] Interop.Word print preview dialog for office 2010/2013

查看:197
本文介绍了办公二千零十三分之二千零十Interop.Word打印预览对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序必须与正在使用 interop.word(查找/替换),然后发送到使用打印预览对话框打印以后替换标签的Word模板:
Interop.Word.Application.Dialogs [WdWordDialog.wdDialogFilePrint]

In my application I have word template with tags which are later replaced using interop.word (find/replace) and then sent to print using print preview dialog: Interop.Word.Application.Dialogs[WdWordDialog.wdDialogFilePrint]

在一个对话框,我的结果打印或关闭文档。

On a result of a dialog I am printing or closing the document.

有关Office 2003和2007这工作绝对没问题,但在办公室2010年晚些时候打印预览对话框是绝对不同的。

For office 2003 and 2007 this is working absolutely fine, but in office 2010 later print preview dialog is absolutely different.

我已经找到相关职位的这里但我需要抓住对话的结果,这样我可以做进一步的打印或关闭文档。

I've found related post here but I need to grab dialog result so that i could further do print or close the doc.

是否有任何解决办法或soultions?

Is there any workaround or soultions for that?

推荐答案

只是为了将来参考张贴回答我自己的问题。最后,我可以计算出来。

Just for the future reference posting answer to my own question. Finally I could figure it out.

下面的代码是工作用字细任何版本。虽然对话框打开的应用程序冻结并等待结果只是作为另一个对话框。

Following code is working with any version of Word fine. While dialog is open application freezes and waits for a result just as another dialogs.

的唯一时刻是它允许只选合适的打印机,但不显示预览。

The only moment is it allows to choose appropriate printer only, but does not show preview.

             _doc.Activate();
             _wordApp.Visible = true;

             var dialogResult = _wordApp.Dialogs[WdWordDialog.wdDialogFilePrint].Show();

             if (dialogResult == 1)
                 _doc.PrintOut();

这篇关于办公二千零十三分之二千零十Interop.Word打印预览对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆