Why wordconv.exe accidentally returns -14 when called from a Windows.NET service

One of my colleagues wrote a Windows.NET service that converts .doc files to .docx. To achieve this, it uses wordconv.exe, which comes with the 2007 Office Compatibility Pack.

In most cases, everything works fine, but under certain circumstances that we have not yet been able to reproduce, wordconv.exe does not convert, but returns exitcode -14.

Unfortunately, this error only occurs in the production environment of our customers. We could not reproduce the error in the development or integration system.

We use 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; 
+2
source share
3 answers

Ok, we just found a problem. Our client saved doc x files with the doc extension. Later they tried to convert this document x to doc x . Using the Office GUI GUI, everything worked fine. Even Word opened a “fake” document file without warning.

+2
source

Can you associate the problem with specific input documents?

If you cannot, can you ensure that there is always only one instance of wordconv.exe?

Perhaps several parallel processes may not be supported (I’m just wildly guessing that we have a service that basically performs the same call, but we have not yet encountered such a problem).

+1
source

I wonder if wordconv suffers the same fate as the rest of Office, i.e. not supported in service application . So bizarre things can happen ...

0
source

Source: https://habr.com/ru/post/1314272/


All Articles