如何以pdf格式下载asp.net表? [英] how to download an asp.net table in a pdf format ?

查看:58
本文介绍了如何以pdf格式下载asp.net表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想点击一下按pdf格式下载我的asp.net表数据。



请帮帮我

谢谢advance

I want to download my asp.net table data in pdf format on a button click .

please help me
Thanks in advance

推荐答案

http://www.aspsnippets.com/Articles/How-to-export-GridView-data-to-PDF-file-in-ASPNet.aspx

使用ITEXTSHARP
http://www.aspsnippets.com/Articles/How-to-export-GridView-data-to-PDF-file-in-ASPNet.aspx
USE ITEXTSHARP


您好,



请点击此链接:

http://www.aspsnippets.com/Articles /Export ChallSet-or fundingTable-to-Word-Excel-PDF-and-CSV-Formats.aspx [ ^ ]



问候,

Praneet
Hi,

Please check this link:
http://www.aspsnippets.com/Articles/Export-DataSet-or-DataTable-to-Word-Excel-PDF-and-CSV-Formats.aspx[^]

Regards,
Praneet


您好,

您可以使用ITEXTS HARP,下载它的DLL并在你的程序中使用它如下..



Hi,
You can use ITEXTSHARP , Download its DLL and use it in your program as follows..

Response.ContentType = "application/pdf";
        Response.AddHeader("content-disposition", "attachment;filename=OutputName.pdf");
        Response.Cache.SetCacheability(HttpCacheability.NoCache);

        StringWriter stringWriter = new StringWriter();
        HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
       
           
            ContentDiv.RenderControl(htmlTextWriter);  // ContentDiv is the container of contents to convert as pdf 

            StringReader stringReader = new StringReader(stringWriter.ToString());
            Document Doc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(Doc);
            PdfWriter.GetInstance(Doc, Response.OutputStream);

            Doc.Open();
            htmlparser.Parse(stringReader);
            Doc.Close();
            Response.Write(Doc);
            Response.End();









谢谢,

Magesh M





Thanks,
Magesh M


这篇关于如何以pdf格式下载asp.net表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆