有没有办法阻止 Microsoft Office Document Image Writer 显示预览?
我正在使用 Microsoft Office Document Image Writer 将 Word 文档转换为 tiff 文件。问题是,每次保存文件时,它都会在预览窗口中显示它。所以我想知道是否有办法阻止它显示此预览窗口?
这是代码:
const string printerName = "Microsoft Office Document Image Writer";
var app = new ApplicationClass();
object filename = "C:\\ad.docx";
docName = "ad.docx";
var missing = Type.Missing;
object trueValue = true;
object falseValue = false;
var doc = app.Documents.Open(ref filename, ref missing, ref trueValue, ref falseValue, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
app.ActivePrinter = printerName;
fileSystemWatcher.Created += FileCreated;
fileSystemWatcher.EnableRaisingEvents = true;
object outputFileName = "c:\\Result\\ad.tif";
key = outputFileName.ToString();
_wait = new AutoResetEvent(false);
doc.PrintOut(ref trueValue, ref falseValue, ref missing, ref outputFileName, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref trueValue, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
_wait.WaitOne();
doc.Close(ref missing, ref missing, ref missing);
app.Quit(ref missing, ref missing, ref missing);
I am using Microsoft Office Document Image Writer to convert a word document to a tiff file. The problem is that ever time it saves a file it shows it in a preview window. So I like to know if there's a way to prevent it from showing this preview window?
here's the code :
const string printerName = "Microsoft Office Document Image Writer";
var app = new ApplicationClass();
object filename = "C:\\ad.docx";
docName = "ad.docx";
var missing = Type.Missing;
object trueValue = true;
object falseValue = false;
var doc = app.Documents.Open(ref filename, ref missing, ref trueValue, ref falseValue, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
app.ActivePrinter = printerName;
fileSystemWatcher.Created += FileCreated;
fileSystemWatcher.EnableRaisingEvents = true;
object outputFileName = "c:\\Result\\ad.tif";
key = outputFileName.ToString();
_wait = new AutoResetEvent(false);
doc.PrintOut(ref trueValue, ref falseValue, ref missing, ref outputFileName, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref trueValue, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
_wait.WaitOne();
doc.Close(ref missing, ref missing, ref missing);
app.Quit(ref missing, ref missing, ref missing);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有找到一种编程方法来执行此操作,但一次性从“另存为”对话框中取消选中“查看文档图像”。
I didn't find a programmatic way of doing this, but on a one time basis, uncheck View Document Image from the Save As dialog.