Convert Datatable to PDF

后端 未结 2 2094
耶瑟儿~
耶瑟儿~ 2020-12-14 04:04

Can I get a code for converting datatable to pdf in Asp.net Web application. I want to have functionality to export datatable into PDF. I found t

2条回答
  •  春和景丽
    2020-12-14 04:55

    You can't "convert" a DataTable to a PDF Document. But you can insert data into it as normal content.

    This would have to be done through a data control, like the GridView or ListView; just like in a normal webpage. Which is why the article you have linked to does that. GridView is probably the closest and easiest way to make it aesthetically appear the same as a DataTable. As it will just be stored as a normal table in the PDF Document.

    Note that the GridView is created in memory - you don't create or need to have one in your HTML page. Try and experiment with the code to understand this better.

    So I recommend following the article.

提交回复
热议问题