pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

scmay private pastebin - collaborative debugging tool What's a private pastebin?


Posted by scmay on Thu 6 Aug 04:18
report abuse | download | new post

  1. private void SaveToExcel()
  2.  {
  3.             IList personList  = //Retrieve a list of details;
  4.             string filename = "filename.xls";
  5.             string path = "C:\filename.xls";
  6.          
  7.             GenerateExcel(personList , filename, path);
  8.  }
  9.   public void GenerateExcel(IList personList , string _fileName, string _locationName)
  10.         {
  11.             StreamWriter fout;
  12.             fout = new StreamWriter(_locationName, true, Encoding.UTF8);
  13.             try
  14.             {
  15.  
  16.                 StringBuilder strBuilder = new StringBuilder();
  17.  
  18.                 strBuilder.Append(Environment.NewLine + "<table border =1 ><tr>");
  19.  
  20.  
  21.                 strBuilder.Append(Environment.NewLine + "<td>" + "ID" + "</td>");
  22.                 strBuilder.Append(Environment.NewLine + "<td>" + "Due Date" + "</td>");
  23.                 strBuilder.Append(Environment.NewLine + "<td>" + "BCMI" + "</td>");
  24.  
  25.                 strBuilder.Append(Environment.NewLine + "</tr>");
  26.  
  27.                 foreach (IPerson person in personList)
  28.                 {
  29.                     strBuilder.Append(Environment.NewLine + "<td>" + payment.ID + "</td>");
  30.                     strBuilder.Append(Environment.NewLine + "<td>" + payment.Name + "</td>");
  31.                     strBuilder.Append(Environment.NewLine + "<td>" + payment.Age + "</td>");
  32.                     strBuilder.Append(Environment.NewLine + "</tr>");
  33.  
  34.                 }
  35.  
  36.  
  37.                 strBuilder.Append(Environment.NewLine + "</table>");
  38.                 fout.WriteLine(strBuilder.ToString());
  39.  
  40.                 fout.Close();
  41.  
  42.                 //Opens the workbook
  43.                 view.Write("<script language=\"Javascript\">window.open('OpenFilePage.aspx?fn=" + _locationName.Replace("\\", "\\\\") +
  44.                            "',\"ExportingExcel\");</script>");
  45.  
  46.  
  47.  
  48.             }
  49.             catch (Exception e)
  50.             {
  51.                 e.StackTrace.ToString();
  52.             }
  53.         }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post