In this article, I am going to explain you how to export DataTable to PDF file using iTextSharp in C# and download or transmit at client machine. Imports Imports Imports parser. Function to get the results in datatable. We will calculate the number of columns in the DataTable to make the columns of the PDF document. We will use iTextSharp to convert the.
|Published (Last):||17 January 2007|
|PDF File Size:||15.50 Mb|
|ePub File Size:||15.44 Mb|
|Price:||Free* [*Free Regsitration Required]|
Hi, This is Mudassar Khan. Next I am using my very own GetData function to get the desired data from the database which is given below.
Sign up using Facebook. Dim sb As New StringBuilder. Below is my connection string to the database.
Newer versions of iTextSharp are not free, better find out which one to use before doing all the work and asked for money later. It first fills the datatable using the GetData function and then binds it to a dummy GridView and then the dummy GridView is rendered as Excel Workbook.
Click here to know about response class. It first fills the datatable using the GetData function and then binds it to a dummy GridView and then the dummy GridView is rendered as Excel Workbook.
Export DataTable to PDF file using iTextSharp and download/transmit at client machine
Load rptName ; RptDoc.
Function to get the results in datatable. Comment by javed March 12, Reply.
Export DataSet or DataTable to Word, Excel, PDF and CSV Formats « .Net All About
Count; foreach DataColumn c in dt. Dim sr As New StringReader sw. In this article I am explaining how to achieve the same in ASP.
ToStringfont5 ; table. Add”Jeans”,2, ; dt. Write pdfDoc ; Response.
How can we export datatable to PDF using iTextSharp
Append orderNo ; sb. You will be notified via email when the author replies to your comment. Chances are they have t don’t get it. Add your solution here. But what do you want to do in window application?? When answering a question please: This completes the article. Dim sw As New StringWriter.
It first fills the datatable using the GetData function and then binds it to a dummy GridView and then the dummy GridView is rendered as Word document. Function to get the results in datatable. Using a FileStream instead of Response and changing the. Append companyName ; sb. It first fills the datatable using the GetData function and then binds dtaset to a dummy GridView and then the dummy GridView is rendered as PDF document using the iTextSharp Library which is a free open source library and can be downloaded from here.
Please Share and Subscribe to support us. About Who Care Who Regret! You are commenting using your WordPress. Hi Everybody, Can you have good idea about how can we export database to PDF using with itextsharp component. B 2, 1 4 Insults are not welcome. In that case, the answer by Nakala is the better solution. If you have a large dataset, this approach will have a serious impact on your memory and CPU use.
This is more general.