pdf动态赋值产生乱码?
我用水晶报表做成PDF后发现从数据库取出来的数据变成了一个个框,没有文字,数字与字母可以?
动态赋值代码:
txtbh = jcb_report.ReportDefinition.ReportObjects.Item("bh")
txtbh.Text = myreader.Item("bh")
dwmc = jcb_report.ReportDefinition.ReportObjects.Item("dwmc")
dwmc.Text = myreader.Item("dwmc")
生成PDF代码:
Dim myexportoptions As CrystalDecisions.Shared.ExportOptions
Dim mydiskfile As New CrystalDecisions.Shared.DiskFileDestinationOptions()
Dim myexportfile As String
myexportfile = Server.MapPath(".") + "\temp\test.dbf"
mydiskfile.DiskFileName = myexportfile
myexportoptions = jcb_report.ExportOptions
With myexportoptions
.DestinationOptions = mydiskfile
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With
jcb_report.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(myexportfile)
Response.Flush()
Response.Close()
结果:中文为乱码?
问题点数:50、回复次数:6Top
1 楼edobnet(oоОoоО)回复于 2003-09-04 15:23:31 得分 10
<configuration>
<system.web>
<globalization requestEncoding="GB2312" responseEncoding="GB2312" culture="zh-CN" fileEncoding="GB2312" />
</system.web>
</configuration>
Top
2 楼flers(思源)回复于 2003-09-05 09:17:06 得分 0
这种方法我试过啦,还是不行啊,UPTop
3 楼flers(思源)回复于 2003-09-11 11:57:51 得分 0
没人会呀,会的请给个提示Top
4 楼yjtc(灵长目)回复于 2003-09-15 12:21:31 得分 10
PDF版本的问题——需要中文支持,PDF中文版的情况,请 WWW.GOOLGE.COM 搜索。Top
5 楼flers(思源)回复于 2003-09-15 12:37:55 得分 0
我用的是中文版的READER,不用安中文包啊Top
6 楼guoyan19811021(吉祥)回复于 2003-09-15 16:39:23 得分 30
Function ToExcel(ByVal ctl As System.Web.UI.Control)
With HttpContext.Current.Response
.Charset = "UTF-8"
.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8")
.ContentType = "Application/pdf"
End With
HttpContext.Current.Response.AppendHeader("content-Disposition", "attachment;filename=" & HttpUtility.UrlEncode(Title1) & ".pdf")
ctl.Page.EnableViewState = False
Dim tw As System.IO.StringWriter = New System.IO.StringWriter()
tw.WriteLine(Title1)
tw.Write(Chr(13) & Chr(10))
tw.WriteLine(Source)
Dim hw As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(tw)
ctl.RenderControl(hw)
HttpContext.Current.Response.Write(tw.ToString)
HttpContext.Current.Response.End()
End FunctionTop




