Bonjour, j'ai un report rdlc et je veux l'exporter directement en pdf : ce code marche tres bien en webform mais pas en windowsform :

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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
try
            {
                Warning[] warnings;
                string[] streamids;
                string mimeType;
                string encoding;
                string extension;
                string deviceInfo = null;
 
                byte[] bytes = reportViewer1.LocalReport.Render(
                "PDF", deviceInfo, out mimeType, out encoding,
                out extension,
                out streamids, out warnings);
 
                // writing bytes to file
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                if (File.Exists(path + filename))
                {
                    File.Delete(path + filename);
                }
 
                Response.Buffer = true;
                Response.Clear();
                Response.ContentType = mimeType;
                Response.AddHeader(
                    "content-disposition",
                    "attachment; filename= " + filename);
                Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file  
                Response.Flush(); // send it to the client to download  
                Response.End();
            }
            catch (Exception ex)
            {
            }
comment le convertir en winform pour faire l'export ?