///       <summary>
        ///       Returns the sepcified list of table DCO objects if it is present in the document.
        ///       <param name="page">DCO objects the corresponds to the current page that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>The sepcified table DCO object if it is present in the page</returns>
        public List <IDCO> getTablesForDocument(IDCO document, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            List <IDCO> tables = new List <IDCO>();

            for (int j = 0; j < document.NumOfChildren(); j++)
            {
                IDCO page = document.GetChild(j);
                if (page.ObjectType() == Constants.Page)
                {
                    for (int i = 0; i < page.NumOfChildren(); i++)
                    {
                        IDCO field = page.GetChild(i);
                        if (isObjectTable(field) && (field.ID == tableName))
                        {
                            tables.Add(field);
                            break;
                        }
                    }
                }
            }
            ExportCore.WriteDebugLog(" getTablesForDocument(" + document + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(tables);
        }
        ///       <summary>
        ///      Checks if a document contains a table.
        ///       <param name="document">DCO objects the corresponds to the current document that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>True if a page contains a table.</returns>
        public bool doesDocumentContainTable(IDCO document, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            bool docHasTable = false;

            for (int j = 0; j < document.NumOfChildren(); j++)
            {
                IDCO page = document.GetChild(j);
                if (page.ObjectType() == Constants.Page)
                {
                    for (int i = 0; i < page.NumOfChildren(); i++)
                    {
                        IDCO field = page.GetChild(i);
                        docHasTable = isObjectTable(field) && (field.ID == tableName);
                        if (docHasTable)
                        {
                            break;
                        }
                    }
                }
            }
            ExportCore.WriteDebugLog(" doesDocumentContainsTable(" + document + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(docHasTable);
        }
Exemplo n.º 3
0
        private void setTableLimits(XmlNode tableNode, IDCO DCO)
        {
            rowStart = 0;
            rowEnd   = DCO.NumOfChildren();

            if (tableNode.Attributes != null && tableNode.Attributes.Count > 0)
            {
                if (!string.IsNullOrEmpty(tableNode.Attributes["fromrow"].Value) &&
                    Int32.Parse(tableNode.Attributes["fromrow"].Value) - 1 > rowStart)
                {
                    rowStart = Int32.Parse(tableNode.Attributes["fromrow"].Value) - 1;
                }
                if (!string.IsNullOrEmpty(tableNode.Attributes["torow"].Value) &&
                    Int32.Parse(tableNode.Attributes["torow"].Value) < rowEnd)
                {
                    rowEnd = Int32.Parse(tableNode.Attributes["torow"].Value);
                }
            }
        }
        ///       <summary>
        ///       Returns the sepcified table DCO object if it is present in the page.
        ///       <param name="page">DCO objects the corresponds to the current page that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>The sepcified table DCO object if it is present in the page</returns>
        public IDCO getTableForPage(IDCO page, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            IDCO table = null;

            for (int i = 0; i < page.NumOfChildren(); i++)
            {
                IDCO field = page.GetChild(i);
                if (isObjectTable(field) && (field.ID == tableName))
                {
                    table = field;
                    break;
                }
            }
            ExportCore.WriteDebugLog(" getTableForPage(" + page + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(table);
        }
        ///       <summary>
        ///      Checks if a page contains a table.
        ///       <param name="page">DCO objects the corresponds to the current page that is being processed.</param>
        ///       <param name="tableName">Name of the table of interest</param>
        ///       <returns>True if a page contains a table.</returns>
        public bool doesPageContainTable(IDCO page, string tableName)
        {
            Stopwatch sw = Stopwatch.StartNew();

            bool pageHasTable = false;

            for (int i = 0; i < page.NumOfChildren(); i++)
            {
                IDCO field = page.GetChild(i);
                pageHasTable = isObjectTable(field) && (field.ID == tableName);
                if (pageHasTable)
                {
                    break;
                }
            }
            ExportCore.WriteDebugLog(" doesPageContainsTable(" + page + "," + tableName + ")" +
                                     " completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
            return(pageHasTable);
        }