Salut ici.
Je vous soumets un problème qui traine depuis une bonne semaine, maintenant.
le code-behind est du vb.Net, sauf l'export du doc, en C#
certains des éléments de la page qui me pose problème sont construits dynamiquement (un tableau, mais surtout 3 images - des graphiques de stats).
Dans la page ASPX, j'ai une balise image, sans source. cette source est définie dynamiquement,d ans le code.
La page web finale s'affiche très bien, mais l'export en .doc ou .pdf (j'ai travaillé sur les deux) se fait bien SAUF que les images n'y sont pas (petite case avec la croix).
- La page aspx jusqu'à l'affichage de la première image (les autres sont sur le même modèle) :
Code ASP.Net : 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154 <form id="Form1" method="post" runat="server"> <P><FONT style="BACKGROUND-POSITION: center center; BACKGROUND-REPEAT: no-repeat" color="white"><FONT face="Verdana" color="#006666" size="4"> <asp:Label id="titre" runat="server"></asp:Label><STRONG> </STRONG> <asp:Label id="soc" runat="server"></asp:Label> - Du <asp:label id="debut" runat="server"></asp:label> au <asp:label id="fin" runat="server"></asp:label></FONT></FONT><FONT style="BACKGROUND-POSITION: center center; BACKGROUND-REPEAT: no-repeat" color="white"><FONT face="Verdana" color="#006666" size="4"> <STRONG> <HR SIZE="1"> </STRONG> <P></P> <P></P> <P></P> <P><FONT style="COLOR: #000000" size="3"><FONT style="COLOR: #000000" face="Verdana" size="2"> <asp:LinkButton id="lk_pdf" runat="server" Font-Size="X-Small">Exporter la page complète vers WORD</asp:LinkButton> </FONT></FONT><FONT style="COLOR: #000000" size="3"><FONT style="COLOR: #000000" face="Verdana" size="2"> </P> <P> <asp:Label id="p1" runat="server"></asp:Label> </FONT> <asp:label id="nbre_ass_total" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"></asp:label><FONT face="Verdana" size="2"> </FONT> <asp:hyperlink id="ass_soc_fond" runat="server" Font-Size="X-Small" Font-Names="Verdana" NavigateUrl="javascript:;"></asp:hyperlink><FONT face="Verdana" size="2"> <asp:Label id="p3" runat="server"></asp:Label> </FONT> <asp:label id="total3" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"></asp:label><FONT face="Verdana" size="2"> <asp:Label id="p4" runat="server"></asp:Label>. <BR> </FONT> <asp:Label id="p5" runat="server" Font-Size="X-Small"></asp:Label> <asp:label id="label_nbre_ass_non" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"></asp:label><FONT face="Verdana" size="2"> <asp:Label id="p6" runat="server"></asp:Label> </FONT> <asp:label id="pourcent_total" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"></asp:label><BR> <FONT face="Verdana" size="2"> <asp:Label id="p7" runat="server"></asp:Label> : </FONT> <asp:label id="oui" runat="server" Font-Size="X-Small" Font-Names="Verdana"></asp:label><FONT face="Verdana" size="2"> sur </FONT> <asp:label id="total2" runat="server" Font-Size="X-Small" Font-Names="Verdana"></asp:label><FONT face="Verdana" size="2">, soit </FONT> <asp:label id="pourcentoui" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"></asp:label><FONT face="Verdana" size="2">.<BR> <asp:Label id="p8" runat="server"></asp:Label> : </FONT> <asp:label id="non" runat="server" Font-Size="X-Small" Font-Names="Verdana"></asp:label><FONT face="Verdana" size="2"> sur </FONT> <asp:label id="total1" runat="server" Font-Size="X-Small" Font-Names="Verdana"></asp:label><FONT face="Verdana" size="2">, soit </FONT> <asp:label id="pourcentnon" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"></asp:label><FONT face="Verdana" size="2">. </FONT></FONT> </P> <FONT size="3"> <P style="COLOR: #006666"> <asp:label id="option1" runat="server" Font-Size="X-Small" Font-Names="Verdana" Visible="False"></asp:label> <asp:label id="Label2" runat="server" Font-Size="X-Small" Font-Names="Verdana" Visible="False"></asp:label><FONT face="Verdana" size="2"> <asp:label id="mot1" runat="server" Visible="False"> sur </asp:label></FONT> <asp:label id="total4" runat="server" Font-Size="X-Small" Font-Names="Verdana" Visible="False"></asp:label><FONT face="Verdana" size="2"> <asp:label id="mot2" runat="server" Visible="False"> soit </asp:label> </FONT> <asp:label id="pourcentov" runat="server" Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True" Visible="False"></asp:label> </FONT> <BR> </P> <P> <asp:image id="ouinon" runat="server"></asp:image></P> <P></P> <STRONG> <HR SIZE="1"> </STRONG> <P></P> <P></P> <P><FONT face="Verdana" size="2"></FONT></P> <P><FONT face="Verdana" size="2"> <asp:label id="soustitre1" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" ForeColor="#006666"></asp:label><STRONG> </STRONG> <asp:hyperlink id="type_resolution" runat="server" NavigateUrl="javascript:;"></asp:hyperlink><STRONG> </STRONG></P> <P> <asp:table id="Table1" runat="server" Font-Size="XX-Small" Font-Names="Verdana" CellPadding="2" BorderWidth="1px" BorderStyle="Groove" GridLines="Both"> <asp:TableRow BorderStyle="Groove" ForeColor="White" BackColor="#006666" Font-Size="XX-Small" Font-Names="Verdana" Font-Bold="True"> <asp:TableCell Text="Type de résolution"></asp:TableCell> <asp:TableCell Text="Oui"></asp:TableCell> <asp:TableCell Text="Non"></asp:TableCell> <asp:TableCell Text="Abstention"></asp:TableCell> </asp:TableRow> </asp:table></P> <P> <asp:image id="reso_graph" runat="server"></asp:image></P> <P><FONT style="COLOR: #000000" face="Verdana" size="2"> <asp:label id="soustitre2" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" ForeColor="#006666"></asp:label></FONT></P> <P> <asp:image id="repart_graph" runat="server"></asp:image></P> <P></P> <STRONG> <HR SIZE="1"> </STRONG> <P></P> <P></P> <P></FONT><STRONG> <asp:label id="soustitre3" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" ForeColor="#006666"></asp:label> </STRONG> <asp:dropdownlist id="Dropdownlist2" runat="server" AutoPostBack="True"> <asp:ListItem Value="0" Selected="True">Toutes Assemblées</asp:ListItem> </asp:dropdownlist> <asp:LinkButton id="LinkButton2" runat="server" Font-Names="Verdana" Font-Size="X-Small"></asp:LinkButton> </P> <P> <asp:datagrid id="DataGrid1" runat="server" CellPadding="4" BorderWidth="3px" BorderStyle="Double" Width="100%" AutoGenerateColumns="False" BackColor="White" BorderColor="#006666" ViewStateMode="Enabled"> <FooterStyle ForeColor="#333333" BackColor="White"></FooterStyle> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#339966"></SelectedItemStyle> <AlternatingItemStyle Font-Names="Verdana" BackColor="Honeydew"></AlternatingItemStyle> <ItemStyle Font-Size="XX-Small" Font-Names="Verdana" ForeColor="#333333" BackColor="White"></ItemStyle> <HeaderStyle Font-Size="XX-Small" Font-Names="Verdana" Font-Bold="True" HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle" BackColor="#006666"></HeaderStyle> <Columns> <asp:BoundColumn DataField="Raison sociale" HeaderText="Raison Sociale"> <ItemStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle> </asp:BoundColumn> <asp:TemplateColumn HeaderText="Date"> <ItemTemplate> <asp:label id="d" runat="server" OnDataBinding="date_load" text='<%# DataBinder.Eval(Container, "DataItem.Date_Assemblee") %>'> </asp:label> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn DataField="ResolutionNumberTag" HeaderText="N°"> <ItemStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#006666" VerticalAlign="Middle"></ItemStyle> </asp:BoundColumn> <asp:BoundColumn DataField="Libellé" HeaderText="Résumé Résolution"></asp:BoundColumn> <asp:BoundColumn DataField="Libellé résolution" HeaderText="Type Résolution"> <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle> </asp:BoundColumn> <asp:TemplateColumn HeaderText="Vote"> <ItemStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#006666" VerticalAlign="Middle"></ItemStyle> <ItemTemplate> <asp:Label runat="server" ondatabinding="text_load" text='<%# DataBinder.Eval(Container, "DataItem.vote_client") %>' ID="Label5"> </asp:Label> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn DataField="comment" HeaderText="Commentaires"></asp:BoundColumn> <asp:BoundColumn Visible="False" DataField="un" HeaderText="un"></asp:BoundColumn> <asp:BoundColumn DataField="Libellé type" HeaderText="Catégorie Résolution"> <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle> <FooterStyle Font-Size="XX-Small" HorizontalAlign="Center" VerticalAlign="Middle"></FooterStyle> </asp:BoundColumn> <asp:BoundColumn DataField = "spécifique6" Visible="False"><ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Font-Italic = "true"/></asp:BoundColumn> <asp:BoundColumn DataField = "code_ov" Visible="False"><ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Font-Italic = "true"/></asp:BoundColumn> <asp:BoundColumn DataField = "cause" HeaderText = "Cause" Visible="False"></asp:BoundColumn> </Columns> <PagerStyle HorizontalAlign="Center" ForeColor="White" BackColor="#336666" Mode="NumericPages"></PagerStyle> </asp:datagrid></P> <P><STRONG> </form>
Le code-behind (les valeurs de xrepart, texte, total et grandeur sont définies dans tableau(), pas d'incidence ici):
Code VB.Net : 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200 Imports ASPNET.StarterKit.Chart Imports System.IO Imports System.Drawing.Imaging Imports System.Drawing Imports System Partial Class Statistiques_SG Inherits System.Web.UI.Page Dim date_debut, date_fin As Date Dim with_ov As Boolean Dim ds As DataSet Dim ds_type_resolution As DataSet Dim ds_votes_non As DataSet Dim ds_assemblees As DataSet Public session_opcvm As Statistiques.Opcvm.type_opcvm Public session_client As Statistiques.Client.type_client Public s As Statistiques.Stats.Stats = New Statistiques.Stats.Stats Public c As Statistiques.Client.Client = New Statistiques.Client.Client Public o As Statistiques.Opcvm.Opcvm = New Statistiques.Opcvm.Opcvm Public self As Statistiques.Configuration.statistiques Public cfg As Statistiques.Configuration.Configuration = New _ Statistiques.Configuration.Configuration Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList Public v As Statistiques.Vote.Vote = New Statistiques.Vote.Vote Dim texte As String Dim grandeur As String Dim total As String Dim xrepart As String Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load session_client = c.charge_client(Request.QueryString("codecli"), Configuration.type_langage.FR) self = cfg.Charge_Statistiques(Configuration.type_langage.FR) If Not IsPostBack Then DataGrid1.AutoGenerateColumns = False Dim indexvote As Integer titre.Text = self.titre soc.Text = session_client.login debut.Text = Request.QueryString("date_debut") fin.Text = Request.QueryString("date_fin") soustitre1.Text = self.soustitre1 soustitre2.Text = self.soustitre2 soustitre3.Text = self.soustitre3 type_resolution.Text = self.lien_typologie LinkButton2.Text = self.lien_excel p1.Text = self.p1 ass_soc_fond.Text = self.p2 p3.Text = self.p3 p4.Text = self.p4 p5.Text = self.p5 p6.Text = self.p6 p7.Text = self.p7 p8.Text = self.p8 ass_soc_fond.Attributes.Add("onclick", "window.open('Stats_Assemblee.aspx?codeclient=" & session_client.code_client & "&codeopcvm=0" & "&date_debut=" & debut.Text & "&date_fin=" & fin.Text & "',null,'height=600, width=800,status= no, resizable= no, scrollbars=yes, toolbar=no,location=no,menubar=no ');") type_resolution.Attributes.Add("onclick", "window.open('Stats_categories.aspx?codeclient=" & session_client.code_client & "&codeopcvm=0" & "&date_debut=" & debut.Text & "&date_fin=" & fin.Text & "',null,'height=600, width=800,status= no, resizable= no, scrollbars=yes, toolbar=no,location=no,menubar=no ');") 'Dim col_vote As BoundColumn = New BoundColumn 'Dim col_cause As BoundColumn = New BoundColumn 'With col_vote ' .ItemStyle.HorizontalAlign = HorizontalAlign.Center ' .ItemStyle.VerticalAlign = VerticalAlign.Middle ' .ItemStyle.Font.Italic = True 'End With If CInt(session_client.code_type_contrat) > 4 Then If Request.QueryString("mode") = 0 Then option1.Visible = False with_ov = False 'col_vote.DataField = "spécifique6" DataGrid1.Columns.Item(9).HeaderText = self.libelle_proxy_adviser DataGrid1.Columns.Item(9).Visible = True DataGrid1.Columns.Item(10).Visible = False DataGrid1.Columns.Item(11).Visible = False indexvote = 9 ' Si comparaison avec Politique Prox ElseIf Request.QueryString("mode") = 1 Then option1.Visible = True option1.Text = self.msg_divergence_proxyadviser Label2.Visible = True total4.Visible = True pourcentov.Visible = True mot1.Visible = True mot2.Visible = True with_ov = False 'col_vote.DataField = "spécifique6" DataGrid1.Columns.Item(9).HeaderText = self.libelle_proxy_adviser DataGrid1.Columns.Item(9).Visible = True DataGrid1.Columns.Item(10).Visible = False DataGrid1.Columns.Item(11).Visible = False indexvote = 9 ' Si comparaison avec OV client ElseIf Request.QueryString("mode") = 2 Then option1.Visible = True option1.Text = self.msg_divergence_client Label2.Visible = True total4.Visible = True pourcentov.Visible = True mot1.Visible = True mot2.Visible = True with_ov = True 'col_vote.DataField = "code_ov" DataGrid1.Columns.Item(10).HeaderText = self.libelle_politique_predefinie DataGrid1.Columns.Item(10).Visible = True DataGrid1.Columns.Item(9).Visible = False DataGrid1.Columns.Item(11).Visible = True indexvote = 10 'col_cause.DataField = "cause" 'col_cause.HeaderText = "Cause" End If End If Label2.Text = "0" ' Recuperation de tous les votes sur toutes les assemblées ds = s.Assemblee_Vote_Fond("0", _ session_client.code_client, _ CDate(debut.Text), _ CDate(fin.Text), with_ov, Configuration.type_langage.FR) Dim dv As New DataView(ds.Tables(0)) Session("dv") = dv DataGrid1.DataSource = dv DataGrid1.DataBind() ' Recuperation des types de resolution ds_type_resolution = s.Charge_Grid_Stats("0", _ session_client.code_client, _ CDate(debut.Text), _ CDate(fin.Text), Stats.type_typologie.AMF, with_ov, Configuration.type_langage.FR) Dim dv2 As New DataView(ds_type_resolution.Tables(0)) Session("dv2") = dv2 gridstat.DataSource = dv2 gridstat.DataBind() ' Recuperation du dataset avec les asssemblees avec vote NON enregistré ds_votes_non = s.Assemblee_Vote_Non("0", _ session_client.code_client, _ CDate(debut.Text), _ CDate(fin.Text), with_ov, Configuration.type_langage.FR) ' Recuperation du dataset avec les assemblees concernée par le fond ds_assemblees = s.Liste_Vote_Assemblee("0", _ session_client.code_client, _ CDate(debut.Text), _ CDate(fin.Text), Configuration.type_langage.FR) label_nbre_ass_non.Text = ds_votes_non.Tables(0).Rows.Count() nbre_ass_total.Text = ds_assemblees.Tables(0).Rows.Count() charge_liste_assemblee() If session_client.code_type_contrat > 5 Then If with_ov = False Then Normalize_Vote_Prox(9) Else Normalize_Vote_Cli(10) End If ov(indexvote) End If calcul() End If tableau() Dim image As Graphique = New Graphique If CType(nbre_ass_total.Text, Integer) > 0 Then image.CreateImage("Votes oui,Votes non", xrepart, True, "ouinon.png", session_client.code_client) image.CreateImage(texte.Substring(1), total.Substring(1), False, "resograph.png", session_client.code_client) image.CreateImage(texte.Substring(1), grandeur.Substring(1), False, "repartgraph.png", session_client.code_client) ouinon.ImageUrl = "http://192.168.0.71/Client/" & session_client.code_client & "/ouinon.png" reso_graph.ImageUrl = "http://192.168.0.71/Client/" & session_client.code_client & "/resograph.png" repart_graph.ImageUrl = "http://192.168.0.71/Client/" & session_client.code_client & "/repartgraph.png" Else ouinon.Visible = False reso_graph.Visible = False repart_graph.Visible = False End If End Sub
La création des images :
Code VB.Net : 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 Imports ASPNET.StarterKit.Chart Imports System.IO Imports System.Drawing.Imaging Imports System.Drawing Imports System Public Class Graphique Public Sub CreateImage(ByVal xValues As String, ByVal yValues As String, ByVal print As Boolean, ByVal name As String, ByVal codecli As String) Dim charttype As String = "pie" Dim stockbitmap As Bitmap Dim imageuri As String = "D:\www\europroxy.com\Client\" & codecli & "\" & name If Not (xValues Is Nothing) And Not (yValues Is Nothing) Then Dim bgColor As Color bgColor = Color.White Dim pc As PieChart If print Then pc = New PieChart Else pc = New PieChart(bgColor) End If pc.CollectDataPoints(xValues.Split(",".ToCharArray()), yValues.Split(",".ToCharArray())) stockbitmap = pc.Draw() stockbitmap.Save(imageuri, ImageFormat.Png) End If End Sub End Class
Et l'export en .doc pour Word(c) :
Code C# : 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ExpertPdf.HtmlToPdf; using System.Net; using System.Text; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { String page, client, mode, date_debut, date_fin, fond; String final_url; //String target_fic, pdf_fic; page = Request.QueryString["page"]; client = Request.QueryString["codecli"]; mode = Request.QueryString["mode"]; date_debut = Request.QueryString["date_debut"]; date_fin = Request.QueryString["date_fin"]; if (page == "Statistiques_Fond.aspx") { fond = Request.QueryString["fond"]; final_url = "http://xxxxxxxxx/Statistiques/" + page + "?codecli=" + client + "&fond=" + fond + "&mode=" + mode + "&date_debut=" + date_debut + "&date_fin=" + date_fin; } else { final_url = "http://xxxxxxxxx/Statistiques/" + page + "?codecli=" + client + "&mode=" + mode + "&date_debut=" + date_debut + "&date_fin=" + date_fin; } HttpWebResponse httpWResponse = null; HttpWebRequest httpWRequest = (HttpWebRequest)WebRequest.Create(final_url); httpWResponse = (HttpWebResponse)httpWRequest.GetResponse(); //System.IO.Stream sr = httpWResponse.GetResponseStream(); //target_fic = Server.MapPath("/client/" + client + "/stats.pdf"); //pdf_fic = "http://xxxxxxxxx/client/" + client + "/stats.pdf"; //PdfConverter pdfConverter = new PdfConverter(); //pdfConverter.LicenseKey = "WKm9pJUz7Cyom7S/aUNC2xI5AVEk3VjQLR+Y+d28B5IPW2uE1YgXuMIqBvTviaK5"; //pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4; //pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal; //pdfConverter.PdfDocumentOptions.LeftMargin = 20; //pdfConverter.PdfDocumentOptions.RightMargin = 20; //pdfConverter.PdfDocumentOptions.TopMargin = 20; //pdfConverter.PdfDocumentOptions.BottomMargin = 20; //pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = false; //pdfConverter.PdfDocumentOptions.ShowHeader = false; //pdfConverter.PdfDocumentOptions.ShowFooter = false; //pdfConverter.PdfSecurityOptions.CanPrint = true; //pdfConverter.PdfSecurityOptions.CanEditContent = false; ////byte[] downloadBytes = pdfConverter.GetPdfFromUrlBytes(final_url); ////pdfConverter.SavePdfFromUrlToFile(final_url, target_fic); //pdfConverter.SavePdfFromHtmlStreamToFile(sr, Encoding.GetEncoding("utf-8"), target_fic); //Response.Redirect(pdf_fic); using (System.IO.StreamReader sr = new System.IO.StreamReader(httpWResponse.GetResponseStream(), System.Text.Encoding.UTF8)) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Charset = ""; HttpContext.Current.Response.ContentType = "application/msword"; string strFileName = "test" + ".doc"; HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName); StringBuilder strHTMLContent = new StringBuilder(); strHTMLContent.Append(sr.ReadToEnd()); HttpContext.Current.Response.Write(strHTMLContent); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); } } }
Je ne sais pas si c'est le type de l'image (ou plutôt la façon dont elle est construite puis insérée dans la page) ou bien la méthode d'export qui n'est pas convenable...
Partager