This is a migrated thread and some comments may be shown as answers.

Export gridview to PDF using itextsharp

3 Answers 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
leo
Top achievements
Rank 1
leo asked on 08 Sep 2014, 09:25 AM
I am trying to export a gridview with itextsharp to PDF but I get some errors i need the source code (C#) of the simplest form to export the gridview to PDF. I am already successfully exporting to PDF "chunk" "phrases" and adding the paragraph to the document. Below these data I want to add the gridview. Can you please provide the code to do this? I just need the code of the simplest form....


Thanks...

3 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 11 Sep 2014, 08:07 AM
Hi,

I am experiencing difficulties understanding the requirement. Could you please elaborate more on what exactly do you mean by the code of the simplest form? Do you want to traverse the grid items on the server or on the client and extract their values? Elaborating more on the aforementioned would facilitate us on providing a precise answer.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
leo
Top achievements
Rank 1
answered on 12 Sep 2014, 09:10 AM
I am trying to export to pdf a gridview and I am using itextsharp. I have imported libraries:

using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html;
using iTextSharp.text.html.simpleparser;

but still does not recognize these two:

iTextSharp.text.Table
The type or namespace name 'Table' does not exist in the namespace 'iTextSharp.text' (are you missing an assembly reference?)
iTextSharp.text.Cell
The type or namespace name 'Cell' does not exist in the namespace 'iTextSharp.text' (are you missing an assembly reference?)

I am using itextsharp.dll 5.5.0.0 and itextsharp.pdfa.dll 5.5.2.0.

how do I export a gridview with itextsharp 5.5.0.0 to pdf?

Also in addition of the gridview I would like to add some text values from my code which as I described I can export them to pdf using Chunks Phrases and added them to the pdf document. Texts using this method right now are successfully exported to pdf. Apart from these texts I would like to add the gridview to the pdf.

Hope its more clear now.
0
Angel Petrov
Telerik team
answered on 17 Sep 2014, 08:59 AM
Hello,

I am not sure what exactly is causing the described problem on your end but it seems that the iTextSharp assembly references are broken. Please remove them, clean the solution, add them again and check whether this resolves the problem.

As for how to export the grid via iTextSharp I am sorry to say but I can not provide a precise answer on how to implement this functionality as I am not familiar with the iTextSharp workings. If you have any specific questions regarding our controls or their functionality however we will gladly answer them.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
leo
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
leo
Top achievements
Rank 1
Share this question
or