Ejemplo n.º 1
0
        public List <TablePos> GetOnlyTablePos(string tableName, LocateConfiguration locateConfiguration, bool isChineseTableName)
        {
            List <TablePos> tablePoses = new List <TablePos>();
            LinePos         linePos    = null;

            _locateConfiguration = locateConfiguration;

            LinePos tableNamePos = GetSearchTextResult(tableName, tableName, ref linePos, true);

            if (tableNamePos == null)
            {
                linePos      = null;
                tableNamePos = GetSearchTextResult(tableName.GetFirstLetter(isChineseTableName), tableName, ref linePos, true);
            }
            if (tableNamePos != null)
            {
                string  tableEndRegex            = locateConfiguration.TableEndRegex;
                string  tableEndFirstLetterRegex = locateConfiguration.TableEndFirstLetterRegex;
                LinePos tableEndPos = GetSearchTextResult(tableEndRegex, tableEndRegex, ref linePos, false);
                if (tableEndPos == null)
                {
                    linePos     = null;
                    tableEndPos = GetSearchTextResult(tableEndFirstLetterRegex, tableEndRegex, ref linePos, false);
                }
                if (tableEndPos == null)
                {
                    tableEndPos = pdfTronHelper.GetBottomPosOfPage(tableNamePos.PageNum, false, -1, -1);
                }
                tablePoses = GetTablePoses(tableNamePos, tableEndPos);
            }
            return(tablePoses);
        }
Ejemplo n.º 2
0
        public List <TablePos> GetMultiTablePos(string tableName, LocateConfiguration locateConfiguration)
        {
            List <TablePos> tablePoses = new List <TablePos>();

            _locateConfiguration = locateConfiguration;
            LinePos        linePos        = null;
            List <LinePos> tableNamePoses = new List <LinePos>();
            List <LinePos> tableEndPoses  = new List <LinePos>();
            LinePos        tableNamePos   = null;

            do
            {
                LinePos linePosCopy = linePos == null ? null : (LinePos)linePos.Clone();
                tableNamePos = GetSearchTextResult(tableName, tableName, ref linePos, true);
                if (tableNamePos == null)
                {
                    linePos      = linePosCopy;
                    tableNamePos = GetSearchTextResult(tableName.GetFirstLetter(true), tableName, ref linePos, true);
                }
                if (tableNamePos != null)
                {
                    string tableEndRegex            = locateConfiguration.TableEndRegex;
                    string tableEndFirstLetterRegex = locateConfiguration.TableEndFirstLetterRegex;
                    linePosCopy = linePos == null ? null : (LinePos)linePos.Clone();
                    LinePos tableEndPos = GetSearchTextResult(tableEndRegex, tableEndRegex, ref linePos, false);
                    if (tableEndPos == null)
                    {
                        linePos     = linePosCopy;
                        tableEndPos = GetSearchTextResult(tableEndFirstLetterRegex, tableEndRegex, ref linePos, false);
                    }
                    if (tableEndPos == null)
                    {
                        tableEndPos = pdfTronHelper.GetBottomPosOfPage(tableNamePos.PageNum, false, -1, -1);
                    }
                    tableNamePoses.Add(tableNamePos);
                    tableEndPoses.Add(tableEndPos);
                }
                else
                {
                    break;
                }
            } while (tableNamePos != null);

            for (int i = 0; i < tableNamePoses.Count; i++)
            {
                List <TablePos> tempPoses = GetTablePoses(tableNamePoses[i], tableEndPoses[i]);
                tablePoses.AddRange(tempPoses);
            }

            return(tablePoses);
        }