为什么从一个.NET Windows服务叫什么时候wordconv.exe随机返回-14 [英] Why does wordconv.exe randomly return -14 when called from a .NET windows service

查看:123
本文介绍了为什么从一个.NET Windows服务叫什么时候wordconv.exe随机返回-14的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个同事写了一个.NET Windows服务转换的.doc为.docx文件。为了实现这一目标,他用wordconv.exe附带Office 2007兼容包。

大多数时候一切正常,但在某些情况下至极,我们无法重现然而,wordconv.exe不转换,而是返回退出code -14。

不幸的是,这个错误仅发生在我们的客户生产环境。我们无法重现该错误在开发或集成系统。

我们正在使用下面的code:

 流程转换器=新工艺();
converter.StartInfo.FileName =<路径wordconv.exe取代;
converter.StartInfo.Arguments =的String.Format( - 音色-NMe \{0} \\{1} \,FILEIN,FILEOUT);
converter.StartInfo.CreateNoWindow = TRUE;
converter.StartInfo.WindowStyle = ProcessWindowStyle.hidden
converter.StartInfo.UseShellExecute = FALSE;
converter.StartInfo.RedirectStandardError = TRUE;
converter.StartInfo.RedirectStandardOutput =真;
converter.Start();
converter.WaitForExit(INTERVALL);
INT退出code = converter.Exit code;
 

解决方案

好了,我们才发现这个问题。我们的客户保存的文档** x **文件与文档扩展名。后来他们试图把这个文档** x **到DOC ** x **。使用Office兼容性包一切的GUI工作的罚款。即使Word,而不一条警告消息拉开了伪造doc文件。

One of my coworkers wrote a .NET windows service that converts .doc to .docx files. In order to accomplish that goal, he uses wordconv.exe which comes with the office 2007 compatibility pack.

Most times everything works fine, but under certain circumstances wich we weren't able to reproduce yet, wordconv.exe doesn't convert, but returns exitcode -14.

Unfortunately, this error only occurs in our customers production environment. We weren't able to reproduce the error in the development or integration system.

We're using the following code:

Process converter = new Process();
converter.StartInfo.FileName = <Path to wordconv.exe>;
converter.StartInfo.Arguments = string.Format("-oice -nme \"{0}\" \"{1}\"", fileIn, fileOut);
converter.StartInfo.CreateNoWindow = true;
converter.StartInfo.WindowStyle = ProcessWindowStyle.hidden
converter.StartInfo.UseShellExecute = false;
converter.StartInfo.RedirectStandardError = true;
converter.StartInfo.RedirectStandardOutput = true;
converter.Start();
converter.WaitForExit(intervall);
int exitCode = converter.ExitCode;

解决方案

Ok, we just found the problem. Our customer saved doc**x** files with a doc extension. Later they tried to convert this doc**x** to doc**x**. Using the GUI of the office compatiblity pack everything worked fine. Even Word opened the "faked" doc file without a warning message.

这篇关于为什么从一个.NET Windows服务叫什么时候wordconv.exe随机返回-14的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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