有人能帮我吗?我是c#新手。
我已经扫描了一张支票,我想从中读取micr行,并从c#中的MICR行获取银行转账号码和支票号码的详细信息,我正在windows应用程序中执行此操作。
public static string ReadOneMICR(string file, int page)
{
try
{
string sout = "";
mut.WaitOne(); // Prevent reentrancy
ClearMicr.CcMicrReader reader = new ClearMicr.CcMicrReader();
reader.Image.Open(file, page);
// Do actual reading
reader.FindMICR();
// Display results
if (reader.MicrCount > 0)
{
ClearMicr.CcMicr Micr = reader.get_MicrLine(1);
sout = sout + "MICR Type: " + Micr.DocumentType + Environment.NewLine;
if (Micr.Routing.IsRead)
sout = sout + "Routing = " + Micr.Routing.TextANSI + Environment.NewLine;
if (Micr.AuxOnUs.IsRead)
sout = sout + "AuxOnUs = " + Micr.AuxOnUs.TextANSI + Environment.NewLine;
if (Micr.OnUs.IsRead)
sout = sout + "OnUs = " + Micr.OnUs.TextANSI + Environment.NewLine;
if (Micr.Amount.IsRead)
sout = sout + "Amount = " + Micr.Amount.TextANSI + Environment.NewLine;
if (Micr.Account.IsRead)
sout = sout + "Account = " + Micr.Account.TextANSI + Environment.NewLine;
if (Micr.CheckNumber.IsRead)
sout = sout + "CheckNumber = " + Micr.CheckNumber.TextANSI + Environment.NewLine;
}
else
sout = "No MICR found";
return sout;
}
catch (Exception ex)
{
return ("ERROR: " + ex.ToString());
}
finally
{
mut.ReleaseMutex();
System.GC.Collect();
}
}下面是示例代码,我在上面的代码中遇到了get_MicrLine和TextANSI行的问题,请告诉我,并为我提供一个在检查中读取micr行的无bug代码。
发布于 2011-06-06 19:21:05
您还没有说明您的错误是什么,但是您可以尝试以下替换行:
ClearMicr.CcMicr Micr = reader.MicrLine[1];https://stackoverflow.com/questions/6251078
复制相似问题