Hi,

How to convert two datagrids into a single PDF....

Thanks in advance...

Recommended Answers

All 4 Replies

Take that two datagrid datasorce into separate datatable.

add the two datatables into one dataset.

and we can easily export the values of dataset to pdf using iTEXTSHARP library.

I dont have much idea about "iTEXTSHARP library".But i can suggest one more mwthod so that you get more options to choose.
Step 1:convert data set to xml
We can use DataSet.GetXml() method for that.
Convert that to string(like DataSet.GetXml() .toString())
step2:
Write an xslt script to convert the above to pdf format
step3:
Use XslCompiledTransform class and its methods Load and transform,to finally convert the xml to pddf.

Hi,

You can use also PDF Duo .NET converting component in ASP.NET projects
(home page http://www.duodimension.com/html_pdf_asp.net/component_html_pdf.aspx)

The main feature of this ASP.NET component is a converting html to pdf. So you can place your datagrids, for example, inside of Panel control and then generate a PDF:

StringWriter objStringWriter = new StringWriter();
HtmlTextWriter objHTMLWriter = new HtmlTextWriter(objStringWriter);
Panel1.RenderControl(objHTMLWriter);
string html = objStringWriter.ToString();        

DuoDimension.HtmlToPdf conv = new DuoDimension.HtmlToPdf();
conv.OpenHTML(html);
conv.SavePDF(MapPath("~/Reports/") + "details.pdf");

Hi, Thank you so much for your reply. It works fine now.

Once again thanks a lot....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.