2013-09-18
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private static string OCR(string fileToOCR)
{
MODI.Document md = new MODI.Document();
md.Create(fileToOCR);
try
{
md.OCR(MODI.MiLANGUAGES.miLANG_CHINESE_SIMPLIFIED, true, true);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return "Error!";
}
MODI.Image img = (MODI.Image)md.Images[0];
MODI.Layout layout = img.Layout;
layout = img.Layout;
string result = layout.Text;
md.Close(false);
return result;
}

Read More