本文介绍了如何使用itextsharp将telerik radgrid导出为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 如何使用itextsharp将telerik radgrid导出为pdf ......我正在获取radgrid的完整源代码....我只想要radgrid绑定设计....我尝试了以下代码: Response.ContentType = application / pdf; Response.AddHeader( content-disposition, attachment; filename = UserDetails.pdf); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); RadGrid1.AllowPaging = false ; RadGrid1.DataBind(); RadGrid1.RenderControl(hw); // RadGrid1.HeaderRow.Style.Add(width,15%); // RadGrid1.HeaderRow.Style.Add(font-size,10px) ; RadGrid1.Style.Add( text-decoration, none); RadGrid1.Style.Add( font-family, Arial,Helvetica,sans-serif;); RadGrid1.Style.Add( font-size, 8px); StringReader sr = new StringReader(sw.ToString()); 文件pdfDoc = 新文件(PageSize.A2,7f,7f,7f,0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc,Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End(); 解决方案 下面是一个示例代码: http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/pdfexport/defaultcs.aspx [ ^ ] 我建议你在适当的论坛上提出这个问题: http:// www .telerik.com / community / forums.aspx [ ^ How to export telerik radgrid to pdf using itextsharp......I am getting the complete source code of radgrid....I just want the radgrid binded design....I tried the following code:Response.ContentType = "application/pdf";Response.AddHeader("content-disposition", "attachment;filename=UserDetails.pdf");Response.Cache.SetCacheability(HttpCacheability.NoCache);StringWriter sw = new StringWriter();HtmlTextWriter hw = new HtmlTextWriter(sw);RadGrid1.AllowPaging = false;RadGrid1.DataBind();RadGrid1.RenderControl(hw);//RadGrid1.HeaderRow.Style.Add("width", "15%");//RadGrid1.HeaderRow.Style.Add("font-size", "10px");RadGrid1.Style.Add("text-decoration", "none");RadGrid1.Style.Add("font-family", "Arial, Helvetica, sans-serif;");RadGrid1.Style.Add("font-size", "8px");StringReader sr = new StringReader(sw.ToString());Document pdfDoc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);HTMLWorker htmlparser = new HTMLWorker(pdfDoc);PdfWriter.GetInstance(pdfDoc, Response.OutputStream);pdfDoc.Open();htmlparser.Parse(sr);pdfDoc.Close();Response.Write(pdfDoc);Response.End(); 解决方案 Here is an example code: http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/pdfexport/defaultcs.aspx[^]I would suggest you to ask this question on proper forum: http://www.telerik.com/community/forums.aspx[^] 这篇关于如何使用itextsharp将telerik radgrid导出为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-08 08:43