Error using MODI in Csharp(office 2007 version)
Recently I have to use MODI (Microsoft office Document Imaging) to do some OCR, I google some codes, one of them is in csharp from here, like below
private static string OCR(string fileToOCR)
MODI.Document md = new MODI.Document();
md.OCR(MODI.MiLANGUAGES.miLANG_CHINESE_SIMPLIFIED, true, true);
catch (Exception e)
MODI.Image img = (MODI.Image)md.Images;
MODI.Layout layout = img.Layout;
layout = img.Layout;
string result = layout.Text;
The code works perfectly at first (System condition is win7+vs2010+MODI(from Microsoft Sharepoint designer)), but the odd thing happens when I reinstall my windows system, the code doesn’t work anymore, it gives me “System.Runtime.InteropServices.COMException, HRESULT:0x80010105 (RPC_E_SERVERFAULT)”. But my system condition is almost the same(win7+vs2010+MODI(from office 2007)).
Then there is another long google process, I have try serveral things
- I install vs2008, because the system has vs2008 when the first time succeeded, but not working.
- Solutions to HRESULT:0x80010105 (RPC_E_SERVERFAULT) not working
Then there are no other information related to this. I noticed that the MODI is from different source(MS sharepoint designer and office 2007), so I try to use new MODI in office 2007, and it’s superisingly not working…. It crashes when you try to OCR a tif image, and when I install office 2007 service pack1, everything is fine…
So, if people have this kind of weird problem, try to install office 2007 sp1, that’s probably the solution.