Bonjour,
Je travaille sur un fichier excel dont je prends une screen avec la fonction copyPicture, je veux ensuite envoyer cette screen par email, mais j'ai soit l'image en attachement non inline, soit l'image qui n'apparaît pas dans mon client de messagerie (lotus note qui gère très bien les images inline). Voici mon code qui pose problème en espérant que quelqu'un puisse m'aider :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
        private Attachment makeScreenshot2()
        {
            Excel.Range r = Globals.Sheet1.Range["A1", "M50"];
            r.CopyPicture(XlPictureAppearance.xlScreen, XlCopyPictureFormat.xlBitmap);
            string path = "C:\\fichier.png";
            Clipboard.GetImage().Save(path);
            var ret = new Attachment(path);
            ret.Name = "Planning.png";
            ret.ContentDisposition.Inline = true;
            ret.ContentDisposition.DispositionType= DispositionTypeNames.Inline;
            ret.ContentId = Path.GetFileName(path).Replace(".", "");
            ret.ContentType.MediaType = "image/png";
            ret.ContentType.Name = Path.GetFileName(path);
            return ret;
        }

Cordialement