Click here to Skip to main content
Rate this: bad
good
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
good
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.
  Permalink  
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The code which I used in asp.net 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());
sw.Flush();
sw.Close();
sw.Dispose();
 
//To DownLoad the excel file. Set the appropriate ContentType.
Response.ContentType = "Application/vnd.ms-excel";
//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.
Response.WriteFile(filePath);
Response.End();
 
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..
  Permalink  
Rate this: bad
good
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 asp.net...
  Permalink  
Comments
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 Maciej Los 295
1 OriginalGriff 273
2 Aajmot Sk 234
3 Marcin Kozub 205
4 Richard MacCutchan 200
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,127
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.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