Exporting to Pdf and word

Posted by sarithasi-16371 under ASP.NET on 7/2/2012 | Points: 10 | Views : 5133 | Status : [Member] | Replies : 7
Hi,

I want to export a large datatable to Word and pdf in web application(with neat format).Please help

Thanks,

Saritha




Responses

Posted by: Kamalakanta.Nayak09 on: 7/2/2012 [Member] Starter | Points: 25

Up
0
Down
Plz Follows this Link:
http://csharp-guide.blogspot.in/2012/06/aspnet-export-datatable-to-word.html


Thanks,
K.K

sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sarithasi-16371 on: 7/2/2012 [Member] Starter | Points: 25

Up
0
Down
I have tried the given link but didn't get the result correctly.Here I am attaching the result.Pls check
 Download source file

sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Panric on: 7/3/2012 [Member] Starter | Points: 25

Up
0
Down
you can use a free data export see the link: http://www.e-iceblue.com/Introduce/free-dataexport-component.html. And also I will direct you to a
post on codeproject: http://www.codeproject.com/Tips/190144/Export-Database-to-Excel-PDF-HTML-RTF-XML-etc-for , you can see how to export to word, PDF, Excel there.

sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lacy on: 7/3/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Panric,
It is really useful.I use Spire.DataExport, a powerful component in exporting data.




sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajkatie on: 7/3/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
For export to Pdf, you can refer following link
http://www.codeproject.com/Articles/10157/Gios-PDF-NET-library

Rajesh Patel
.Net Trainer(M.C.S.A | MCT)
Brainbench (Asp.Net 4.5 and C# 5.0)

sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muralidosscm on: 7/3/2012 [Member] Starter | Points: 25

Up
0
Down
Namespace to be as follows...........

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


C# Code

protected void btnExport_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}


this code will help u

Regards
Muralidoss M

sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajkatie on: 7/22/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Please visit following link
http://www.aspsnippets.com/Articles/Export-GridView-To-Word-Excel-PDF-CSV-Formats-in-ASP.Net.aspx

Rajesh Patel
.Net Trainer(M.C.S.A | MCT)
Brainbench (Asp.Net 4.5 and C# 5.0)

sarithasi-16371, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response