/// <summary> /// Fetches the column value for a row of a table. /// <param name="columnName">Column name</param> /// <param name="pageID">Page ID from where the value needs to be extracted</param> /// <returns>The value of the column for the current row of a table.</returns> public string getColumnValueForRow(string columnName) { ExportCore.WriteLog("inside getColumnValueForRow " + columnName); string columnValue = ""; TDCOLib.IDCO row = null; Stopwatch sw = Stopwatch.StartNew(); // the current iternation DCO would point to a row of a table if (!Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO).Equals(Constants.EMPTYSTRING)) { row = (TDCOLib.IDCO)Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO); for (int k = 0; k < row.NumOfChildren(); k++) { TDCOLib.DCO column = row.GetChild(k); if (column.ObjectType() == Constants.Field && columnName == column.ID) { ExportCore.WriteLog(columnName + " = " + column.Text); columnValue = column.Text; break; } } } else { string message = " Error occured while fetching value for column " + columnName; ExportCore.WriteLog(message); throw new SmartExportException(message); } ExportCore.WriteDebugLog(" getColumnValueForRow(" + columnName + ") completed in " + sw.ElapsedMilliseconds + " ms."); sw.Stop(); return(columnValue); }
/// <summary> /// The method returns the page ID of the specified page type in the specified document. /// <param name="DCOTree">DCO Expression in the format [DCO].[document_type].[page_type].[field_name]</param> /// <param name="DocumentID">Docuemnt ID</param> /// <param name="pageType">Page tyep</param> /// <returns>The page ID of the specified page typs in the specified document.</returns> /// </summary> public List <string> getPageIDsOfTypeInDocument(string DCOTree, string documentID, string pageType) { TDCOLib.IDCO currentIterationDCO = null; if (!Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO).Equals(Constants.EMPTYSTRING)) { currentIterationDCO = (TDCOLib.IDCO)Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO); } List <string> pageIDs = new List <string>(); int noOfChildren = currentIterationDCO == null?CurrentDCO.NumOfChildren() : currentIterationDCO.NumOfChildren(); for (int i = 0; i < noOfChildren; i++) { TDCOLib.DCO child = currentIterationDCO == null?CurrentDCO.GetChild(i) : child = currentIterationDCO.GetChild(i);; //If the call is from ForEach, this will be having a currentIterationDCO object. if (child.Type == pageType) { pageIDs.Add(child.ID); } if (1 < pageIDs.Count) { string message = " There is more than one page of type " + pageType + " in the document " + documentID; ExportCore.WriteLog(message); } } if (0 == pageIDs.Count) { string message = " There is no page of type " + pageType + " in the document " + documentID; ExportCore.WriteLog(message); } return(pageIDs); }
/// <summary> /// The method creates a map of file name and a list of the pages that it contains /// and saves it in the global constants. /// </summary> public void createFilePageMap() { Dictionary <string, List <string> > filePageMap = new Dictionary <string, List <string> >(); if (CurrentDCO.ObjectType() == Constants.Batch) { for (int i = 0; i < CurrentDCO.NumOfChildren(); i++) { TDCOLib.IDCO childDCO = CurrentDCO.GetChild(i); if (childDCO.ObjectType() == Constants.Page) { SmartNav.SetRRCurrentDCO(childDCO); string imageName = SmartNav.MetaWord(Constants.SMARTP_AT + "P.ScanSrcPath"); List <string> pages = null; if (filePageMap.ContainsKey(imageName)) { pages = filePageMap[imageName]; } else { pages = new List <string>(); } pages.Add(childDCO.ID); filePageMap[imageName] = pages; ExportCore.WriteInfoLog(" file page map " + imageName + " : " + childDCO.ID + "; size : " + pages.Count); } } Globals.Instance.SetData(Constants.FILE_PAGE_MAP, filePageMap); SmartNav.SetRRCurrentDCO(CurrentDCO); } else { throw new SmartExportException("Unable to create File-Page map, since the associated level is not Batch."); } }
/// <summary> /// Checks if the DCO object is a table. /// <param name="table">DCO object</param> /// <returns>True if the DCO object is a table</returns> /// </summary> public bool isObjectTable(TDCOLib.IDCO table) { bool isTable = false; for (int j = 0; j < table.NumOfChildren(); j++) { TDCOLib.DCO row = table.GetChild(j); if (row.ObjectType() == Constants.Field) { for (int k = 0; k < row.NumOfChildren(); k++) { TDCOLib.DCO column = row.GetChild(k); if (column.ObjectType() == Constants.Field) { isTable = true; break; } } } } return(isTable); }