任何人都可以告訴我如何將數據從gridview導出爲pdf在c#中。如何在c#中將gridview導出爲pdf#
0
A
回答
1
有no build in class in .Net
希望這些鏈接可以幫助你
http://csharpdotnetfreak.blogspot.com/2008/12/export-gridview-to-pdf-using-itextsharp.html
0
看看這個免費的圖書館ITextSharp
0
沒有什麼內置的基類庫.NET允許你生成PDF文件LES。您可能需要使用第三方庫,如iTextSharp。
0
我推薦使用Crystal Reports。它不會允許您直接導出gridview,但可以提取並顯示相同的數據。
0
您必須添加(iTextSharp的)的這個參考..
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
protected void GeneratePDF_Click(object sender, EventArgs e)
{
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);
GridView1.AllowPaging = false;
GridView1.DataBind();
GridView1.RenderControl(hw);
GridView1.HeaderRow.Style.Add("width", "15%");
GridView1.HeaderRow.Style.Add("font-size", "10px");
GridView1.Style.Add("text-decoration", "none");
GridView1.Style.Add("font-family", "Arial, Helvetica, sans-serif;");
GridView1.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();
}
相關問題
- 1. 將GridView導出爲PDF格式的c#
- 2. UserControl將GridView導出爲PDF
- 3. ITextSharp將GridView導出爲PDF時出錯
- 4. 如何在Asp.net和C#中將GridView數據導出爲pdf文件?
- 5. 將gridview數據導出爲pdf
- 6. 如何將數據從devexpress gridview導出爲pdf在mvc
- 7. 在asp.net中導出gridview在pdf文件
- 8. 如何在php中使用Codeigniter將gridview數據導出爲pdf文件
- 9. 如何使用c#中的OpenXML將GridView導出爲excel?
- 10. 將HTML導出爲PDF(C++,Windows)
- 11. 如何將Drupal圖書導出爲PDF?
- 12. 如何將甘特圖導出爲pdf?
- 13. 如何將JIRA報告導出爲PDF?
- 14. 如何將UIView導出爲PDF文件
- 15. iTextSharp類在c中輸出pdf gridview#
- 16. 將gridview導出爲PDF時超鏈接字段爲空
- 17. 在PHP中將html導出爲PDF?
- 18. 在html中將html導出爲pdf
- 19. 如何使用DotNetNuke(DNN)在PDF中導出Gridview數據?
- 20. 將gridview導出爲.xls
- 21. 如何使用asp.net GridView中導出圖像,並使用asp.net或導出GridView的數據,以PDF數據到PDF
- 22. 如何使用C#將asp.net中的gridview導出到Excel中?
- 23. 將圖像導出爲PDF
- 24. 將HTML導出爲PDF
- 25. 將JasperReport導出爲PDF OutputStream?
- 26. 將html表導出爲pdf
- 27. 將HTML頁導出爲PDF
- 28. 將網頁導出爲PDF
- 29. 將網頁導出爲PDF
- 30. 將DataWindow導出爲PDF
非常感謝......但是,這不是有沒有辦法不使用任何第三方代碼,這樣做? – NayeemKhan 2010-10-27 07:19:48
我不這麼認爲.. – anishMarokey 2010-10-27 07:34:44