Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. I have been trying to generate some reports to PDF file format from ASP. NET2.0 application (using itextsharp.dll)

I have been trying to generate some reports to PDF file format from ASP. NET2.0 application (using itextsharp.dll)

Scheduled Pinned Locked Moved ASP.NET
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 3117172
    wrote on last edited by
    #1

    this code not working can any help Document document = new Document(); try { System.IO.MemoryStream msReport = new System.IO.MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(document, msReport); document.Open(); iTextSharp.text.Table datatable = new iTextSharp.text.Table(8); datatable.Padding = 4; datatable.Spacing = 0; //datatable.setBorder(Rectangle.NO_BORDER); float[] headerwidths = { 50, 50, 50, 50, 50, 40, 40, 45 }; datatable.Widths = headerwidths; datatable.WidthPercentage = 100; Cell cell = new Cell(new Phrase("Applicant Wise Report", FontFactory.GetFont(FontFactory.HELVETICA, 15 ,Font.BOLD))); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.Leading = 15; cell.Colspan = 8; cell.Border = Rectangle.NO_BORDER; cell.BackgroundColor = new Color(0xC0, 0xC0, 0xC0); datatable.AddCell(cell); datatable.DefaultCellBorderWidth = 1; datatable.DefaultHorizontalAlignment = 1; datatable.DefaultRowspan = 1; datatable.AddCell(new Phrase("Name", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Address", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("State", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("City", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Email ID", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Exam Attended", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Result Status", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Exam Date", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.DefaultCellBorderWidth = 1; datatable.DefaultRowspan = 1; if (Dt.Rows.Count > 0) { for (int i = 0; i <= Dt.Rows.Count - 1; i++) { datatable.DefaultHorizontalAlignment = Element.ALIGN_LEFT; string name = Convert.ToString(Dt.Rows[i][0]); datatable.AddCell(new Cell(new Phrase(name, FontFactory.GetFont(FontFactory.TIMES, 10, Font.NORMAL))),i+1,0); string address = Convert.ToString(Dt.Rows[i][1]); datatable.A

    D 1 Reply Last reply
    0
    • M Member 3117172

      this code not working can any help Document document = new Document(); try { System.IO.MemoryStream msReport = new System.IO.MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(document, msReport); document.Open(); iTextSharp.text.Table datatable = new iTextSharp.text.Table(8); datatable.Padding = 4; datatable.Spacing = 0; //datatable.setBorder(Rectangle.NO_BORDER); float[] headerwidths = { 50, 50, 50, 50, 50, 40, 40, 45 }; datatable.Widths = headerwidths; datatable.WidthPercentage = 100; Cell cell = new Cell(new Phrase("Applicant Wise Report", FontFactory.GetFont(FontFactory.HELVETICA, 15 ,Font.BOLD))); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.Leading = 15; cell.Colspan = 8; cell.Border = Rectangle.NO_BORDER; cell.BackgroundColor = new Color(0xC0, 0xC0, 0xC0); datatable.AddCell(cell); datatable.DefaultCellBorderWidth = 1; datatable.DefaultHorizontalAlignment = 1; datatable.DefaultRowspan = 1; datatable.AddCell(new Phrase("Name", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Address", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("State", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("City", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Email ID", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Exam Attended", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Result Status", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.AddCell(new Phrase("Exam Date", FontFactory.GetFont(FontFactory.TIMES, 11, Font.BOLD))); datatable.DefaultCellBorderWidth = 1; datatable.DefaultRowspan = 1; if (Dt.Rows.Count > 0) { for (int i = 0; i <= Dt.Rows.Count - 1; i++) { datatable.DefaultHorizontalAlignment = Element.ALIGN_LEFT; string name = Convert.ToString(Dt.Rows[i][0]); datatable.AddCell(new Cell(new Phrase(name, FontFactory.GetFont(FontFactory.TIMES, 10, Font.NORMAL))),i+1,0); string address = Convert.ToString(Dt.Rows[i][1]); datatable.A

      D Offline
      D Offline
      darkcalin
      wrote on last edited by
      #2

      Try to use BinaryReader.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups