首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在C#中读取MICR行

如何在C#中读取MICR行
EN

Stack Overflow用户
提问于 2011-06-06 19:03:41
回答 1查看 2.9K关注 0票数 1

有人能帮我吗?我是c#新手。

我已经扫描了一张支票,我想从中读取micr行,并从c#中的MICR行获取银行转账号码和支票号码的详细信息,我正在windows应用程序中执行此操作。

代码语言:javascript
复制
 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代码。

EN

回答 1

Stack Overflow用户

发布于 2011-06-06 19:21:05

您还没有说明您的错误是什么,但是您可以尝试以下替换行:

代码语言:javascript
复制
ClearMicr.CcMicr Micr = reader.MicrLine[1];
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6251078

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档