有人能帮我吗?我是新来的#
我已经扫描了一张支票,从中我想读取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_micr line和textansi行代码中遇到了一些问题,请澄清我的问题,并为我提供一个无错误的代码,用于读取检查中的micr行
最佳答案
您尚未说明错误所在,但可以尝试以下替换行:
ClearMicr.CcMicr Micr = reader.MicrLine[1];
关于c# - 如何在C#中读取Micr行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6251078/