Attacher un document à Infopath
Dans un article précédent nous avons vu comment créer un fichier excel sans excel. Maintenant, ce fichier excel on va l’attacher à notre fichier infopath.
Je vais utiliser le contrôle “File Attachment” dans le formulaire, car c’est celui-ci qui me permet de stocker le fichier à l’intérieur même du formulaire.
code: //ici je vais chercher le contrôle XPathNavigator attached = root.SelectSingleNode(“/my:myFields/my:attachedFiles”, NamespaceManager); //cette fonction supprime l’attribut nil s’il est trouvé. DeleteNil(attached);//maintenant je place un string dans ce contrôle au format base64, ce string représente le fichier à attacher.
attached.SetValue(file);
public void DeleteNil(XPathNavigator node) { if (node.MoveToAttribute(“nil”, “http://www.w3.org/2001/XMLSchema-instance”)) node.DeleteSelf(); } Voila il n’en faut pas plus pour attacher un document à formulaire InfoPath.
Catégories:C#, dotNet, infopath, informatique
c#, dotnet, InfoPath, informatique

Commentaires Récents