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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. Print Datatable

Print Datatable

Scheduled Pinned Locked Moved WPF
question
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.
  • P Offline
    P Offline
    Prajeesh
    wrote on last edited by
    #1

    Hi, I have a datatable as DataTable dt = new DataTable( "Table1" ); dt.Columns.Add( "c1" ); dt.Columns.Add( "c2" ); dt.Columns.Add( "c3" ); DataRow dr = dt.NewRow(); dr["c1"] = "100"; dr["c2"] = "100"; dr["c3"] = "100"; dt.Rows.Add( dr ); dt.AcceptChanges(); printListView.DataContext = dt; I have also a listview for showing the table. How can I print this table? Thanks Prajeesh Prabhakar

    P 1 Reply Last reply
    0
    • P Prajeesh

      Hi, I have a datatable as DataTable dt = new DataTable( "Table1" ); dt.Columns.Add( "c1" ); dt.Columns.Add( "c2" ); dt.Columns.Add( "c3" ); DataRow dr = dt.NewRow(); dr["c1"] = "100"; dr["c2"] = "100"; dr["c3"] = "100"; dt.Rows.Add( dr ); dt.AcceptChanges(); printListView.DataContext = dt; I have also a listview for showing the table. How can I print this table? Thanks Prajeesh Prabhakar

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      What I would do is create a FixedDocument which contains a Table that uses the datasource that you are using here, rather than using a ListView. Then, you use a DocumentPaginator and use this with PrintDialog.PrintDocument.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      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