gpt4 book ai didi

c# - 如何在 C# 中读取 micr 行

转载 作者:可可西里 更新时间:2023-11-01 12:04:43 27 4
gpt4 key购买 nike

谁能帮帮我,我是 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 行

最佳答案

你没有说你的错误是什么,但你可以试试这个替换行:

ClearMicr.CcMicr Micr = reader.MicrLine[1];

关于c# - 如何在 C# 中读取 micr 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6251078/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com