Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#3.0
how to convert the database data into pdf or excel format
Posted 10-Feb-12 1:32am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I assume you intend: "How to report database data on a PDF document or an Excel one".
To write a PDF document you need a library. You may write to Excel using automation or, for instance via OLEDB. You may find many tutorials about all these techniques.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

The code which I used in for downloading the data as excel format:
first store all the values into a dataset. Then take one string builder and append all the values of dataset in a table format. Then pass that string builder to the stringwriter as below and follow the overall code below:
Here below "sb" means stringbuilder object as example
// Save the format as MsExcel file in a folder(.xls)
StringWriter sw = new StringWriter(sb);
File.WriteAllText(HttpContext.Current.Request.ServerVariables["APPL_PHYSICAL_PATH"].ToString() + "\\folder path\\" + filename + ".xls", sb.ToString());
//To DownLoad the excel file. Set the appropriate ContentType.
Response.ContentType = "Application/";
//Get the physical path to the file.
string filePath = HttpContext.Current.Request.ServerVariables["APPL_PHYSICAL_PATH"].ToString() + "\\folderpath\\" + currYear + ".xls";
Response.AppendHeader("content-disposition", "attachment; filename= " + filename + ".xls");
//Write the file directly to the HTTP content output stream.
Now first the file will be stored in your folderpath and automatically it will ask to download..
If u want how to write dataset into a stringbuilder means ask. I will give small example..
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

I want to upload pdf data(What ever details in pdf document sya roll number student name marks..etc) in aql server database using
ThePhantomUpvoter at 24-May-13 8:24am
So? How does this answer this already answered question that is over a year old?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 329
2 CPallini 260
3 DamithSL 214
4 Maciej Los 197
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115

Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 24 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100