示例#1
0
 /// <summary>Gets the xfa field value.</summary>
 /// <param name="name">the fully qualified field name</param>
 /// <returns>the field value</returns>
 public virtual String GetXfaFieldValue(String name)
 {
     if (IsXfaPresent())
     {
         name = FindFieldName(name);
         if (name != null)
         {
             name = Xml2Som.GetShortName(name);
             return(iText.Forms.Xfa.XfaForm.GetNodeText(FindDatasetsNode(name)));
         }
     }
     return(null);
 }
示例#2
0
 /// <summary>Changes a field value in the XFA form.</summary>
 /// <param name="name">the name of the field to be changed</param>
 /// <param name="value">the new value</param>
 public virtual void SetXfaFieldValue(String name, String value)
 {
     if (IsXfaPresent())
     {
         name = FindFieldName(name);
         if (name != null)
         {
             String shortName = Xml2Som.GetShortName(name);
             XNode  xn        = FindDatasetsNode(shortName);
             if (xn == null)
             {
                 xn = datasetsSom.InsertNode(GetDatasetsNode(), shortName);
             }
             SetNodeText(xn, value);
         }
     }
 }
示例#3
0
        /// <summary>Finds the complete field name from a partial name.</summary>
        /// <param name="name">the complete or partial name</param>
        /// <returns>the complete name or <CODE>null</CODE> if not found</returns>
        public virtual String FindFieldName(String name)
        {
            if (acroFieldsSom == null && xfaPresent && datasetsSom != null)
            {
                IDictionary <String, XNode> name2Node = datasetsSom.GetName2Node();
                ICollection <String>        keys      = name2Node.Keys;
                acroFieldsSom = new AcroFieldsSearch(keys);
            }

            if (acroFieldsSom != null && xfaPresent)
            {
                List <string> parts = new List <string>(new Stack <string>(Xml2Som.SplitParts(name)));

                bool containsKey = acroFieldsSom.GetAcroShort2LongName().ContainsKey(name);

                string inverse = acroFieldsSom.InverseSearchGlobal(parts);
                string normal  = acroFieldsSom.GetAcroShort2LongName().Get(name);

                return(containsKey ? normal : inverse);
            }
            return(null);
        }
示例#4
0
 /// <summary>
 /// Finds the complete SOM name contained in the datasets section from a
 /// possibly partial name.
 /// </summary>
 /// <param name="name">the complete or partial name</param>
 /// <returns>the complete name or <CODE>null</CODE> if not found</returns>
 public virtual String FindDatasetsName(String name)
 {
     return(datasetsSom.GetName2Node().ContainsKey(name) ? name : datasetsSom.InverseSearchGlobal
                (new List <string>(new Stack <string>(Xml2Som.SplitParts(name)))));
 }
示例#5
0
 /// <summary>Finds the complete field name from a partial name.</summary>
 /// <param name="name">the complete or partial name</param>
 /// <returns>the complete name or <CODE>null</CODE> if not found</returns>
 public virtual String FindFieldName(String name)
 {
     if (acroFieldsSom == null && xfaPresent)
     {
         acroFieldsSom = new AcroFieldsSearch(datasetsSom.GetName2Node().Keys);
         return(acroFieldsSom.GetAcroShort2LongName().ContainsKey(name) ? acroFieldsSom.GetAcroShort2LongName
                    ().Get(name) : acroFieldsSom.InverseSearchGlobal(new List <string>(new Stack <string>(Xml2Som.SplitParts(name)))));
     }
     return(null);
 }