ITEXTSHARP DATASET TO PDF

0 Comments

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.

Author: Galmaran JoJotilar
Country: Botswana
Language: English (Spanish)
Genre: Technology
Published (Last): 23 April 2014
Pages: 41
PDF File Size: 18.37 Mb
ePub File Size: 12.67 Mb
ISBN: 432-1-49734-244-8
Downloads: 77087
Price: Free* [*Free Regsitration Required]
Uploader: Kajishakar

In this article I am explaining how to achieve the same in ASP. For this tutorial I am using NorthWind Database which can be downloaded from here. Once that is downloaded you can attach the same to your SQL Server.

Below is my connection string to the database. Function to get the results in datatable. Next I am using my very own GetData function to get the desired data from the database which is given below.

Dim dt As New DataTable. Catch ex As Exception.

As you can see above I am passing the query to the GetData function and it returns the results as datatable back. Below is the code to export the datatable to Word Format. 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.

Dim sw As New StringWriter. The figure below displays the generated Microsoft Word Document. Below is the code to export the datatable to Excel Format.

  ALL F2L ALGORITHMS PDF

It first fills the datatable using the GetData function and itextsuarp binds it to a dummy GridView and then the dummy GridView is rendered as Excel Workbook. Also you will notice I applied textmode style to all the rows so that it in rendered as text. Add “class””textmode”. Add “class””textmode”.

The dataswt below displays the generated Microsoft Excel Sheet. Below is the code to export the datatable to PDF Format. 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 PDF document using the iTextSharp Library which is a free open source library and can be downloaded from here. A4, 10f, 10f, 10f, 0f. Dim sr As New StringReader sw. The figure below displays the generated PDF Document.

It first fills the datatable using the GetData function. We just have to loop through the records and append the delimiting character comma. Dim sb As New StringBuilder.

The figure below displays the generated CSV File. This completes the article. You can download the code in VB.

Net and C using the link below. Connection String Below is my connection string to the database.

Thank you for the feedback. The comment is now awaiting moderation. You will be notified via email when the author replies to your comment. You can add your comment about this article using the form below. Make sure you provide a valid email address else you won’t be notified when the author replies to your comment Please note that all comments are moderated and will be deleted if they are Not relavant to the article Spam Advertising campaigns or links to other sites Abusive content.

  GRANADOS VALSES POETICOS GUITAR PDF

Please do not post code, scripts or snippets. Required Invalid Email Address. Required Invalid security code. I declare, I accept the site’s Privacy Policy. Hi, This is Mudassar Khan.

How can we export datatable to PDF using iTextSharp

Thank you for visiting this website. Ask our team at ASPForums. Please Share and Subscribe to support us. The code samples and API available at www.

Export DataSet or DataTable to Word Excel PDF and CSV Formats

You are free to use it for commercial as well as non-commercial use at your own risk, but you cannot use it for posting on blogs or other tutorial websites similar to www. All the code samples and API provided by the authors are solely their creation and neither the author nor the site are responsible if it does not work as intended.

I agree to the above terms. What our readers say. This site makes use of Cookies. Please refer Privacy Policy for more details.