Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1.  protected void ExportToExcell(ExcelExporter.Output mode)
  2.     {
  3.         var exporter = new ExcelExporter("List: LineItem Volume Report");
  4.        
  5.         // Add header texts:
  6.         exporter.AddColumn("Submitted date", "DateTime");
  7.         exporter.AddColumn("Account Name");
  8.         exporter.AddColumn("Contact");
  9.         exporter.AddColumn("Search type");
  10.         exporter.AddColumn("Search Status");
  11.         exporter.AddColumn("Address");
  12.        
  13.         this.AddSearchFilters();
  14.        
  15.         // Add data rows:
  16.        
  17.         foreach (var Item in this.GetDataSource())
  18.         {
  19.             exporter.AddRow(
  20.                 "{0:dd/MM/yy}".FormatWith(Item.Order.SubmittedDate),
  21.             Item.Order.Contact.Account.Name,
  22.             Item.Order.Contact,
  23.             Item.Product,
  24.             Item.Status,
  25.             Item.Order.Address.FullAddress);
  26.         }
  27.        
  28.         Response.Dispatch(exporter.Generate(mode), "{0}-{1}".FormatWith(LocalTime.Now,VolumeReport.GetReportType()) + exporter.GetFileExtension(mode), "application/vnd.ms-excel", true, System.Text.Encoding.UTF8);
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement